1

I am creating an app for Google Glass and I want a menu with over 15 options. I want it to be similar to this one. I have tried many different options, In my XML I have:

      <item
        android:id="@+id/option1"
        android:title="@string/option1"
       android:icon="@drawable/ic_stop"/>
      <item
        android:id="@+id/option2"
        android:title="@string/option2"
        android:icon="@drawable/ic_stop" />
      <item
        android:id="@+id/option3"
        android:title="@string/option3"
        android:icon="@drawable/ic_stop" />
      ....

How do I make the options menu be able to be operated with the tilt of your head? Thanks.

Rami
  • 7,879
  • 12
  • 36
  • 66
Mark
  • 11
  • 1
  • Thank you all :D I would upvote all of you, but don't have any "reputation" yet. Can you also look at [link]http://stackoverflow.com/questions/24288220/google-glass-time Thanks :) – Mark Jun 18 '14 at 14:29

3 Answers3

0

I think that what you see in the picture you posted is not a menu. Is a ListView. As far as I know ListView in Google GLASS works as you ask...

kodartcha
  • 1,063
  • 12
  • 23
0

That is defenetly a layout and it doesn't have to do anything with menus.

<LinearLayout
android:layout_witdh="fill_parent"
android:layout_height="fill_parent"
android:orientation="landscape">

<TextView
    android:layout_witdh="0dp"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:layout_weight="1"/>

<ListView
    android:layout_witdh="0dp"
    android:layout_height="fill_parent"
    android:layout_weight="1"
    android:fadingEdge="vertical"
    android:fadingEdgeLength="5dp"/>
</LinearLayout>

the layout should be something like that, then in your activity you can build an adapter with all the menu items you want.

This it is not too much related with google glass except that the user will expect to head-scroll the ListView. To do that check out this question that talks about it. There seems to be an OS project that implement the behavior you need.

Community
  • 1
  • 1
Mario Lenci
  • 10,422
  • 5
  • 39
  • 50
0

they automatically get added to the menu screen as head-tiltable scroll list. find some more info on voice menu items here: contextual voice commands and some code from one we've got with more than a couple menu items.

<?xml version="1.0" encoding="utf-8"?>

<item
    android:id="@+id/take_picture"
    android:title="@string/take_picture">
</item>

<item
    android:id="@+id/take_video"
    android:title="@string/take_video">
</item>


<item
    android:id="@+id/voice_card"
    android:title="@string/voice_card">
</item>

<item
    android:id="@+id/add_item"
    android:title="@string/add_item">
</item>

<item
    android:id="@+id/remove_item"
    android:title="@string/remove_item">
</item>

you can just keep adding menu items to your menu layout and they will be displayed

medright
  • 138
  • 10