Android 无法启动搜索活动
我正在开发一个android应用程序,我需要实现对提要元素的搜索。我在网上学习了一些教程,但仍然有一些错误,它无法启动搜索活动。谁能帮我一下吗?谢谢 以下是其中的一些代码: 用于搜索活动的xml布局文件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
<?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);
}