简体   繁体   English

选择searchview android不用图标

[英]select searchview android not with the icon

I have a view that goes like this : 我的观点是这样的:

<LinearLayout
    android:id="@+id/searchPart"
    android:layout_width="fill_parent"
    android:layout_height="90dp"
    android:background="@drawable/moviesearch"
    android:gravity="center"
    android:weightSum="100" >

    <SearchView
        android:id="@+id/query"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:layout_weight="90"
        android:background="@android:color/background_light"
        android:queryHint="Enter query :" >
    </SearchView>
</LinearLayout>

But to select do a search with the searchview widget we must tap on the search icon, and not anywhere else. 但要选择使用searchview小部件进行搜索,我们必须点击搜索图标,而不是其他任何地方。 Is there a way to bypass that by taping on the entire frame ? 有没有办法通过贴上整个框架绕过它?

A little late but i hope it helps someone. 有点晚了,但我希望它有所帮助。

To show the SerchView always opened add this in your layout file: 要显示始终打开的SerchView,请在布局文件中添加:

android:iconifiedByDefault="false"

If you want to set it programatically try this: 如果要以编程方式设置它,请尝试以下操作:

YourSearchView.setIconifiedByDefault(false);

Otherwise, use true as parameter value. 否则,使用true作为参数值。

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

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