[英]How to add mic button in searchview of actionbar
I want to add mic in searchview of actionbar. 我想在动作栏的searchview中添加麦克风。
I tried this ActionBar Mic Button(Voice Search) in SearchView . 我在SearchView中尝试过此ActionBar麦克风按钮(语音搜索) 。 but mic is not showing in searchview 但麦克风未显示在searchview中
Please help 请帮忙
Add this lines in your searchable. 将此行添加到您的可搜索内容中。
android:voiceSearchMode="showVoiceSearchButton|launchRecognizer"
and put the android:launchMode="singleTop"
in your Manifest's activity tag. 并将android:launchMode="singleTop"
放入清单的活动标签中。
<activity android:name=".Activity.MainActivity"
android:launchMode="singleTop"
>
....
<intent-filter>
<action android:name="android.intent.action.SEARCH"></action>
</intent-filter>
<meta-data android:name="android.app.default_searchable"
android:value=".Activity.MainActivity"
></meta-data>
<meta-data android:name="android.app.searchable"
android:resource="@xml/searchable">
</meta-data>
</activity>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.