Android搜索小部件默认情况下如何隐藏搜索视图中的关闭按钮? [英] Android search widget How to hide the close button in search view by default?

查看:141
本文介绍了Android搜索小部件默认情况下如何隐藏搜索视图中的关闭按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在ActionBar中实现了一个android SearchView.当SearchView获得焦点时,将显示右侧的关闭按钮[x].我看了一下其他Android本机应用程序,例如联系人"和"Gmail". SearchView获得焦点时,关闭按钮不显示.

如何设置SearchView这样的行为?

I have implemented an android SearchView in ActionBar. When the SearchView gains focus, the close button [x] at the right shows up. I took a look at other android native apps, like Contacts and Gmail. The close button is not shown when the SearchView gains focus.

How to set my SearchView behave like that?

推荐答案

设置searchView.setIconifiedByDefault(false)将禁用折叠搜索视图并删除关闭按钮.

Setting searchView.setIconifiedByDefault(false) will disable collapsing the search view and also remove the close button.

这篇关于Android搜索小部件默认情况下如何隐藏搜索视图中的关闭按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆