您现在的位置是:主页 > news > 做金馆长网站网站/seo推广需要多少钱

做金馆长网站网站/seo推广需要多少钱

admin2025/5/2 0:38:40news

简介做金馆长网站网站,seo推广需要多少钱,微信公司网站,网站开发的项目总结原文地址为&#xff1a; Android搜索控件SearchView的用法最近看Android 4.0 mms&#xff0c;contact源码&#xff0c;发现其中搜索都是SearchView控件&#xff0c;下面自己试着写一个 效果 1.在res/menu/文件夹下建立menu.xml 配置文件 <menu xmlns:android"http:/…

做金馆长网站网站,seo推广需要多少钱,微信公司网站,网站开发的项目总结原文地址为&#xff1a; Android搜索控件SearchView的用法最近看Android 4.0 mms&#xff0c;contact源码&#xff0c;发现其中搜索都是SearchView控件&#xff0c;下面自己试着写一个 效果 1.在res/menu/文件夹下建立menu.xml 配置文件 <menu xmlns:android"http:/…
原文地址为: Android搜索控件SearchView的用法

最近看Android 4.0  mms,contact源码,发现其中搜索都是SearchView控件,下面自己试着写一个

效果

1.在res/menu/文件夹下建立menu.xml 配置文件

<menu
  xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@+id/search" android:title="@string/search" 
    android:icon="@drawable/search_app_icon" 
    android:showAsAction="ifRoom|withText" //在actionBar显示,
    android:actionViewClass="android.widget.SearchView"
    
    ></item>

</menu>

2.新建一个activity,并为该activity添加菜单项,CreateOptionSMenu代码

 @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // TODO Auto-generated method stub
       mi.inflate(R.menu.my_menu, menu);
        MenuItem search=menu.findItem(R.id.search);
         search.collapseActionView();
         SearchView searchview=(SearchView) search.getActionView();
        searchview.setIconifiedByDefault(false);
         SearchManager mSearchManager=(SearchManager)getSystemService(Context.SEARCH_SERVICE);
             SearchableInfo info=mSearchManager.getSearchableInfo(getComponentName());
               searchview.setSearchableInfo(info); //需要在Xml文件加下建立searchable.xml,搜索框配置文件
           return true;
    }
3.在xml文件夹下简历searchable.xml

  <searchable xmlns:android="http://schemas.android.com/apk/res/android"
        android:label="@string/app_name"
        android:hint="@string/search_title"
      
        android:searchSettingsDescription="@string/search_title"
        android:searchSuggestAuthority="com.digua.fncontact.familyName"
        android:searchSuggestIntentAction="android.intent.action.VIEW"
        android:searchSuggestIntentData="content://com.digua.fncontact.familyName/fname"
        android:searchSuggestSelection=" ?"
        android:searchSuggestThreshold="1"
        android:inputType="text"  
       android:voiceSearchMode="showVoiceSearchButton|launchRecognizer"
       android:searchMode="queryRewriteFromText"
        android:includeInGlobalSearch="true"
        android:queryAfterZeroResults="true"
        >
 </searchable>

具体serachable属性请看上一篇转载博客,

http://blog.csdn.net/androidchuxueze/article/details/7590732

示例下载

http://download.csdn.net/detail/androidchuxueze/5005369


转载请注明本文地址: Android搜索控件SearchView的用法