默认显示的Andr​​oid搜索查看的EditText [英] Show android SearchView EditText by default

查看:97
本文介绍了默认显示的Andr​​oid搜索查看的EditText的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用android系统中一个搜索查看。当我第一次降落在页面上所有可见的搜索图标。然后,当我点击该图标,出现的EditText。我如何获得的EditText可见从一开始走?这里是我的xml:

 <搜索查看
        机器人:ID =@ + ID /搜索
        机器人:layout_width =0dp
        机器人:layout_height =match_parent
        机器人:layout_weight =1
        机器人:queryHint =@字符串/ search_hint
        机器人:TEXTSIZE =16SP/>


解决方案

编辑---

噢,对不起!我因子评分你想要做一个空查询。
我想你可以用编程方式打开搜索查看:

  searchView.setIconified(假);

OLD答案 -

内的活动,你可以试试:

  onSearchRequested();

和一个片段里,你可以试试:

  getActivity()onSearchRequested()。

祝你好运!

I am using a SearchView in android. When I first land on the page, all that is visible is the search icon. Then when I click on the icon, the EditText appears. How do I get the EditText to be visible from the get go? Here is my xml:

<SearchView
        android:id="@+id/search"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:queryHint="@string/search_hint"
        android:textSize="16sp" />

解决方案

EDIT---

Oh sorry! I tought you wanted to do an 'empty' query. I think you can open SearchView programmatically using:

searchView.setIconified(false);

OLD ANSWER--

Inside an Activity you can try with:

onSearchRequested();

And inside a Fragment you can try with:

getActivity().onSearchRequested();

Good luck!

这篇关于默认显示的Andr​​oid搜索查看的EditText的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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