- Print
- DarkLight
Using XML to Define Vocabulary
Beginning with OS 4.0.0 you can define custom speech commands and control the placement the speech hint UI overlay bubbles in your application XML without using the speech SDK directly.
While this mechanism does not give the same level of control as using the Vuzix Speech SDK, it is a very simple mechanism to customize the speech behavior whenever your code runs on a Vuzix M400 without negatively affecting your application on non-Vuzix devices.
vuzix_bubble_location
This tag defines one of nine predefined locations, or an x,y offset for the overlay.
The values can be:
"TOP_START"
"TOP_CENTER"
"TOP_END"
"CENTER_START"
"CENTER_CENTER"
"CENTER_END"
"BOTTOM_START"
"BOTTOM_CENTER"
"BOTTOM_END"
“x,y“
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/test_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="vuzix_bubble_location:BOTTOM_START"
android:contentDescription="vuzix_bubble_location:10,5">
</RelativeLayout>
vuzix_voice_command
This tag changes the overlay behavior so that instead of a numeric index the given text is shown.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/test_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="vuzix_voice_command:foobar">
</RelativeLayout>
vuzix_use_text
This tag changes the overlay behavior so that instead of a numeric index the text of the UI element is shown. (NOTE that vuzix_use_text does not take an argument, so does not not have a “:” following it
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/test_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Test Button"
android:contentDescription="vuzix_use_text">
</RelativeLayout>