Dashboard layout in Android
If you need to implement a Dashboard layout in Android, you can use the great DashboardLayout from Google I/O 2011 app: DashboardLayout.java
You just place children elements into it like this:
<com.google.android.apps.iosched.ui.widget.DashboardLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/dashboard_grid"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
style="@style/Dashboard">
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_dash_icon1"
style="@style/Dashboard.Button"
android:text="@string/dash_btn_live"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_dash_icon1"
style="@style/Dashboard.Button"
android:text="@string/dash_btn_live"/>
</com.google.android.apps.iosched.ui.widget.DashboardLayout>
These are the styles the layout refers to:
<style name="Dashboard.Button">
<item name="android:textColor">@color/text_dash_button</item>
<item name="android:background">@color/transparent</item>
<item name="android:textSize">@dimen/dash_button_text</item>
</style>
<style name="Dashboard">
<item name="android:listSelector">@color/dash_selector</item>
<item name="android:background">@color/dash_bg</item>
</style>
The key here is using a transparent background and a drawableTop attribute for the buttons' icons.
EDIT Nov 20th, 2012: updated DashboardLayout code link
Written by Sebastiano Poggi
Related protips
5 Responses
Interesting :)
over 1 year ago
·
grt ;-)
over 1 year ago
·
well, this is interesting... :)
over 1 year ago
·
Link's down.
over 1 year ago
·
@gnclmorais it took a bit to find it, but here's another link: https://raw.github.com/gist/882650/3f31e40dc9fe2e0f59a1fc6490a0f2c96a2826f3/DashboardLayout.java
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Dashboard
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#