重写搜索龙preSS重写、preSS

2023-09-04 05:39:33 作者:风流先生

在众多Android手机,当用户长时间presses的搜索按钮,它启动了谷歌语音搜索的意图。如何可以覆盖此功能在整个系统,而不仅仅是覆盖搜索按钮长presses从活动中?更具体地讲,我如何才能增加我的应用程序是相同类型的意图是谷歌语音搜索,以便它显示为选择应用程序选项时,搜索按钮是pssed长$ P $。非常感谢!

On many Android phones, when a user long presses the Search button, it launches the Google Voice Search intent. How can override this feature across the entire system, not just overriding Search button long presses from an activity? More specifically, how can I add my app to be the same type of intent as Google Voice Search so that it shows up as a "Choose Application" option when the Search button is long pressed. Thanks a lot!

推荐答案

尝试使用android.intent.action.SEARCH_LONG_ $ P $干燥综合征与类别为android.intent.category.DEFAULT在你行动的意图过滤器在你的Andr​​oidManifest.xml

Try using "android.intent.action.SEARCH_LONG_PRESS" as your action with the category as "android.intent.category.DEFAULT" under your intent-filters in your AndroidManifest.xml

<application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".YourActivityName" android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.SEARCH_LONG_PRESS" />
                <category android:name="android.intent.category.DEFAULT" /> 
            </intent-filter>
        </activity>

    </application>