首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >有选择地设置子菜单项上的语音输入约束

有选择地设置子菜单项上的语音输入约束
EN

Stack Overflow用户
提问于 2014-01-03 22:22:50
回答 1查看 254关注 0票数 0

正如我所发现的,如果某些功能不可用,可以设置语音约束来禁用语音触发器。我认为这也适用于消除歧义子菜单,所以我尝试在子菜单中的一个活动上设置一个约束,而不是对其他的。然而,这不只是禁用该子菜项(“从列表中选择”),而是禁用了整个菜单(“发出请求”)。下面是我的清单和语音触发xml资源:

AndroidManifest.xml:

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.twintitanium.glassapps.decisionmaker"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="15"
        android:targetSdkVersion="15" />

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <service
            android:name="com.twintitanium.glassapps.decisionmaker.DecisionMakerService"
            android:enabled="true"
            android:exported="true"
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name" >
        </service>

        <activity
            android:name="com.twintitanium.glassapps.decisionmaker.MenuActivity"
            android:enabled="true"
            android:theme="@style/MenuTheme" >
        </activity>
        <activity
            android:name="com.twintitanium.glassapps.decisionmaker.ChooseFromListActivity"
            android:label="@string/choice_from_list"
            android:icon="@drawable/ic_choose_from_list" >
            <intent-filter>
                <action android:name="com.google.android.glass.action.VOICE_TRIGGER" />
            </intent-filter>
            <meta-data
                android:name="com.google.android.glass.VoiceTrigger"
                android:resource="@xml/make_a_request_with_network_constraint_trigger" />
        </activity>
        <activity
            android:name="com.twintitanium.glassapps.decisionmaker.RollDieActivity"
            android:label="@string/die_roll"
            android:icon="@drawable/ic_roll_die" >
            <intent-filter>
                <action android:name="com.google.android.glass.action.VOICE_TRIGGER" />
            </intent-filter>
            <meta-data
                android:name="com.google.android.glass.VoiceTrigger"
                android:resource="@xml/make_a_request_trigger" />
        </activity>
        <activity
            android:name="com.twintitanium.glassapps.decisionmaker.FlipCoinActivity"
            android:label="@string/coin_flip"
            android:icon="@drawable/ic_flip_coin" >
            <intent-filter>
                <action android:name="com.google.android.glass.action.VOICE_TRIGGER" />
            </intent-filter>
            <meta-data
                android:name="com.google.android.glass.VoiceTrigger"
                android:resource="@xml/make_a_request_trigger" />
        </activity>
        <activity
            android:name="com.twintitanium.glassapps.decisionmaker.YesNoActivity"
            android:label="@string/yes_or_no"
            android:icon="@drawable/ic_yes_no" >
            <intent-filter>
                <action android:name="com.google.android.glass.action.VOICE_TRIGGER" />
            </intent-filter>
            <meta-data
                android:name="com.google.android.glass.VoiceTrigger"
                android:resource="@xml/make_a_request_trigger" />
        </activity>
    </application>

</manifest>

正如您所看到的,我将make_a_request_with_network_constraint_trigger用于ChooseFromListActivity,而make_a_request_trigger用于其他活动。

make_a_request_with_network_constraint_trigger.xml:

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<trigger keyword="@string/glass_voice_trigger">
    <constraints
        network="true" />
</trigger>

make_a_request_trigger.xml:

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<trigger keyword="@string/glass_voice_trigger" />

(为了澄清,“@string/glaseVoice触发器”是“发出请求”)。

给一个活动的网络约束是否会禁用整个菜单,即使其他活动没有相同的约束呢?是否有另一种方式有选择地约束一种活动而不是其他活动?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-01-03 22:25:54

这听起来不像是你想要的行为。请您在我们的问题跟踪器上输入一个bug,这样我们就可以进一步调查了吗?

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20913804

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档