简体   繁体   English

如何禁用可搜索活动?

[英]how to disable a searchable activity?

I make an app and use a property called "android.app.default_searchable" like this: 我制作了一个应用,并使用了一个名为“ android.app.default_searchable”的属性,如下所示:

<meta-data android:name="android.app.default_searchable" android:value=".ui.MainTabActivity" />

so that when I click the search button on the keyboard, it will jump to the specific activity. 这样,当我单击键盘上的搜索按钮时,它将跳至特定活动。 but now I want some activities not to respond the search action. 但现在我希望某些活动不响应搜索操作。 so how to config them in the manifest.xml or in other ways? 那么如何在manifest.xml或其他方式中配置它们?

Add this to the activities where you do NOT want search. 将此添加到您不想搜索的活动中。 Tapping on the search button will do nothing. 轻按搜索按钮不会执行任何操作。

@Override
public boolean onSearchRequested() {
    return true;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM