如何使SearchView始终在android中扩展? [英] How to make SearchView always expanded in android?

查看:48
本文介绍了如何使SearchView始终在android中扩展?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在布局的顶部(不是在操作栏中)有SearchView,是否有什么办法强制将此View始终展开(打开)?

I have SearchView in the top of the layout (not in the action bar), is there anyway to force this View to be always expanded (opened)?

如果没有,我希望在其附近放置精美的图像,是否有必要在展开(单击/展开)后使SearchView隐藏该图像?

If not, i wish to place fancy image near it, is there anyway to make SearchView hide this image when expanded (clicked/expanded)?

推荐答案

您可以在XML上使用属性android:iconifiedByDefault="false"或通过编程方式设置setIconifiedByDefault(false).根据文档,此属性可根据需要设置SearchView展开的位置.

You can use the property android:iconifiedByDefault="false" on XML or set programatically setIconifiedByDefault(false). Acording to the documentation this property set the SearchView expanded like you want.

看看 SearchView.setIconifiedByDefault(boolean iconified)

这篇关于如何使SearchView始终在android中扩展?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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