[英]Menu long-click opens different SearchView widget in action bar
I have a search icon in my Activity
's action bar and when I click it it opens a default Android SearchView
widget in my action bar. 我的“
Activity
”操作栏中有一个搜索图标,当我单击它时,它会在我的操作栏中打开一个默认的Android SearchView
小部件。 However, if I long-click capacitive menu button on my Samsung Galaxy S3 device it opens a different SearchView
widget that doesn't even match with my app's action bar. 但是,如果我在Samsung Galaxy S3设备上长按电容菜单按钮,它将打开另一个与我的应用程序的操作栏不匹配的
SearchView
小部件。 Furthermore, with menu long-click I can open the SearchView
widget in my searchable Activity
that doesn't even have the search icon in the action bar and isn't the desired Activity
to support the SearchView
widget in the action bar, it is just for handling the search Intent
. 此外,通过长按菜单,我可以在
searchable Activity
中打开SearchView
小部件,该searchable Activity
甚至在操作栏中没有搜索图标,也不是在操作栏中支持SearchView
小部件的理想Activity
用于处理搜索Intent
。 I'll post some screenshots for you to better understand my problem... 我将发布一些屏幕截图供您更好地了解我的问题...
My MainActivity
with search icon: 我的带有搜索图标的
MainActivity
: My
MainActivity
with SearchView
widget expanded via search icon press: 我的带有
SearchView
小部件的MainActivity
通过按搜索图标展开: My
MainActivity
after menu long-click (completely different SearchView
widget style): 菜单长按后我的
MainActivity
(完全不同的SearchView
小部件样式): My
searchable Activity
(doesn't contain search icon and shouldn't provide search): 我的
searchable Activity
(不包含搜索图标,也不应该提供搜索): My
searchable Activity
after menu long-click ( SearchView
widget shouldn't exist here...): 菜单长按后我的
searchable Activity
( SearchView
小部件在这里不应该存在...): So I am asking you to help me to find out:
因此,我想请您帮助我找出答案:
SearchView
widget? SearchView
小部件? SearchView
widget in the searchable Activity
that shouldn't support search functionality but just handle the search Intent
sent from my MainActivity
which should be the only Activity
that contains the search icon and search functionality? searchable Activity
中打开SearchView
小部件,而只处理从我的MainActivity
发送的搜索Intent
,它应该是唯一包含搜索图标和搜索功能的Activity
? SearchView
widget as the search icon in the action bar and only in the MainActivity
? SearchView
小部件,并且仅在MainActivity
中打开? Here's the answer for 4th question. 这是第四个问题的答案。 Add this function in your activity class.
在活动类中添加此函数。
@Override
public boolean onSearchRequested() {
return false;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.