Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 无法启动搜索活动_Android_Xml_Search_Android Activity - Fatal编程技术网

Android 无法启动搜索活动

Android 无法启动搜索活动,android,xml,search,android-activity,Android,Xml,Search,Android Activity,我正在开发一个android应用程序,我需要实现对提要元素的搜索。我在网上学习了一些教程,但仍然有一些错误,它无法启动搜索活动。谁能帮我一下吗?谢谢 以下是其中的一些代码: 用于搜索活动的xml布局文件 <?xml version="1.0" encoding="utf-8"?> <searchable xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="mat

我正在开发一个android应用程序,我需要实现对提要元素的搜索。我在网上学习了一些教程,但仍然有一些错误,它无法启动搜索活动。谁能帮我一下吗?谢谢

以下是其中的一些代码:

用于搜索活动的xml布局文件

<?xml version="1.0" encoding="utf-8"?>
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:hint="Pretrazi feed"
    android:label="app_label" 
    android:textAppearance="?android:attr/textAppearanceLarge">
</searchable>
用于启动主活动的搜索活动的代码

public void Search() {
    Intent i = new Intent(this, SearchActivity.class);
    startActivity(i);
}        

您收到了什么错误?这是我收到的错误:java.lang.RuntimeExction:无法启动活动组件信息{etf.ba.android/etf.ba.android.searchActivity}:android.view.InflateExcetion:二进制XML文件行#2:膨胀可搜索类时出错
public class SearchActivity extends Activity {
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.xml.search);
    }
}
public void Search() {
    Intent i = new Intent(this, SearchActivity.class);
    startActivity(i);
}