Android 操作栏中的搜索功能不起作用
我正在尝试创建一个搜索栏和搜索列表查看项目。 它不起作用。 问题:当我输入查询并按Ok/enter键时,我的TrickPage(活动)不会被触发 我正在根据官方教程开发搜索小部件界面: TrickPage(主要活动) 舱单:Android 操作栏中的搜索功能不起作用,android,listview,search,Android,Listview,Search,我正在尝试创建一个搜索栏和搜索列表查看项目。 它不起作用。 问题:当我输入查询并按Ok/enter键时,我的TrickPage(活动)不会被触发 我正在根据官方教程开发搜索小部件界面: TrickPage(主要活动) 舱单: <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" androi
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/MyTheme" android:logo="@drawable/ic_launcher" android:restoreAnyVersion="false">
<activity
android:name="com.meygraph.illustratortutorials.SplashScreen"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Black.NoTitleBar"
android:windowSoftInputMode="stateHidden" >
<meta-data
android:name="android.app.searchable"
android:resource="@xml/searchable">
</meta-data>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<!-- Parent activity meta-data to support 4.0 and lower -->
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.meygraph.illustratortutorials.Main" />
</intent-filter>
</activity>
请帮帮我 考虑到
SplashScreen
是您希望搜索小部件调用的活动,请在应用程序标记中添加以下内容:
我想您在添加适配器后忘记添加此呼叫:
listViewArticles.setTextFilterEnabled(true);
我希望这对你有帮助;)
public class Folder {
public int folderIcon;
public String folderName;
public String folderDescription;
// Constructor.
public Folder(int folderIcon, String folderName,
String folderDescription) {
this.folderIcon = folderIcon;
this.folderName = folderName;
this.folderDescription = folderDescription;
}
}
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/MyTheme" android:logo="@drawable/ic_launcher" android:restoreAnyVersion="false">
<activity
android:name="com.meygraph.illustratortutorials.SplashScreen"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Black.NoTitleBar"
android:windowSoftInputMode="stateHidden" >
<meta-data
android:name="android.app.searchable"
android:resource="@xml/searchable">
</meta-data>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<!-- Parent activity meta-data to support 4.0 and lower -->
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.meygraph.illustratortutorials.Main" />
</intent-filter>
</activity>
<meta-data android:name="android.app.default_searchable"
android:value="com.meygraph.illustratortutorials.SplashScreen" />
listViewArticles.setTextFilterEnabled(true);