共用方式為


Intent.CategoryAccessibilityShortcutTarget Field

Definition

The accessibility shortcut is a global gesture for users with disabilities to trigger an important for them accessibility feature to help developers determine whether they want to make their activity a shortcut target.

[Android.Runtime.Register("CATEGORY_ACCESSIBILITY_SHORTCUT_TARGET", ApiSince=30)]
public const string CategoryAccessibilityShortcutTarget;
[<Android.Runtime.Register("CATEGORY_ACCESSIBILITY_SHORTCUT_TARGET", ApiSince=30)>]
val mutable CategoryAccessibilityShortcutTarget : string

Field Value

Implements

Attributes

Remarks

The accessibility shortcut is a global gesture for users with disabilities to trigger an important for them accessibility feature to help developers determine whether they want to make their activity a shortcut target.

An activity of interest to users with accessibility needs may request to be the target of the accessibility shortcut. It handles intent #ACTION_MAIN with this category, which will be dispatched by the system when the user activates the shortcut when it is configured to point at this target.

An activity declared itself to be a target of the shortcut in AndroidManifest.xml. It must also do two things: <ul> <ol> Specify that it handles the android.intent.action.MAINandroid.content.Intent with category android.intent.category.ACCESSIBILITY_SHORTCUT_TARGET. </ol> <ol> Provide a meta-data entry android.accessibilityshortcut.target in the manifest when declaring the activity. </ol> </ul> If either of these items is missing, the system will ignore the accessibility shortcut target. Following is an example declaration:

&lt;activity android:name=".MainActivity"
            . . .
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
                  &lt;category android:name="android.intent.category.ACCESSIBILITY_SHORTCUT_TARGET" /&gt;
              &lt;/intent-filter&gt;
              &lt;meta-data android:name="android.accessibilityshortcut.target"
                              android:resource="@xml/accessibilityshortcut" /&gt;
            &lt;/activity&gt;

This is a sample XML file configuring a accessibility shortcut target:

&lt;accessibility-shortcut-target
                android:description="@string/shortcut_target_description"
                android:summary="@string/shortcut_target_summary"
                android:animatedImageDrawable="@drawable/shortcut_target_animated_image"
                android:htmlDescription="@string/shortcut_target_html_description"
                android:settingsActivity="com.example.android.shortcut.target.SettingsActivity" /&gt;

Both description and summary are necessary. The system will ignore the accessibility shortcut target if they are missing. The animated image and html description are supported to help users understand how to use the shortcut target. The settings activity is a component name that allows the user to modify the settings for this accessibility shortcut target.

Java documentation for android.content.Intent.CATEGORY_ACCESSIBILITY_SHORTCUT_TARGET.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to