Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Glass GDK Theme for XML layout

Is there a theme that we can use in Eclipse or Android Studio for doing XML layouts? I know we should use:

<style name="CustomTheme" parent="@android:style/Theme.DeviceDefault">

to get the Glass theme on the device, but how about while laying out in the editor?

like image 610
Patrick Avatar asked Nov 22 '13 16:11

Patrick


2 Answers

Since it looks like the XML got eaten up in your original post, I'll repeat the tips to get the Glass theme on the device: remove any android:theme attributes that your IDE has automatically inserted, or if you need a custom theme, have it inherit from Theme.DeviceDefault (see GDK: Glass theme and UI widgets).

Eclipse and Android Studio do not yet provide an out-of-the-box exact Glass layout experience. You can approximate it fairly well by creating a device definition in the AVD Manager that matches the screen resolution on Glass (640 × 360, notlong, hdpi) as suggested by this post.

Then, select that device definition in your layout editor. You may also want to select Theme.DeviceDefault.FullScreen.NoActionBar to remove the status bar and action bar in your editor preview.

like image 106
Tony Allevato Avatar answered Oct 28 '22 13:10

Tony Allevato


You might want to look at how I accomplished getting the Glass theme (which is just no theme as discussed in https://developers.google.com/glass/develop/gdk/ui/theme-widgets) in a Hello World app for Glass. Since the ADT in Eclipse creates a Theme by default and assigns it to the application in AndroidManifest.xml, I just had to remove it.

Here is a Git commit that shows this in action: https://github.com/luisdelarosa/HelloGlass/commit/a58208ddef2b9b25ac605735da0dd93860492477

Specifically I looked for this line in AndroidManifest.xml and removed it:

android:theme="@style/AppTheme"

I also removed the res/values/styles.xml since it was not being used anymore - it only had the themes in it.

As for having a graphical editor for Glass layouts, I don't think this is that well supported yet since we are still in Sneak Peek mode. Perhaps once we get to the Developer Preview mode, the Glass team will create editors that will allow us to design for the Glass UI exactly.

like image 41
louielouie Avatar answered Oct 28 '22 12:10

louielouie