How to make a simpe UI for android?
the UI i want is like below:
------------------------------+ head|btn1|btn2|btn2 | ------------------------------- Content | Content | | | 开发者_如何学Go | | | | | | | | ------------------------------| foot|btn3|btn4|btn5 | ------------------------------|
Anyone know how to design xml for this ui?
This is the type of XML layout you'll be looking for:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout
android:id="@+id/header"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:orientation="horizontal"
>
<View android:id="@+id/head" />
<Button android:id="@+id/btn1" />
<Button android:id="@+id/btn2" />
<Button android:id="@+id/btn3" />
</LinearLayout>
<LinearLayout
android:id="@+id/footer"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal"
>
<View android:id="@+id/foot" />
<Button android:id="@+id/btn4" />
<Button android:id="@+id/btn5" />
<Button android:id="@+id/btn6" />
</LinearLayout>
<ListView
android:id="@+id/body"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@id/footer"
android:layout_below="@id/header"
/>
</RelativeLayout>
Obviously you'll need to expand on the contents of the header and footer, but that's the basic structure. You set the header and footer to wrap_content, align them to the top and bottom, respectively, then the ListView is set below and above the header and footer, respectively, and fills the remaining space left by the header and footer.
Hey that sounds quite simple. The easiest way to get started with something like this would be to use something like http://www.droiddraw.org/ it"s a visual editor for Android UIs. Once you have the basic Layout you can export it to you app and then tweak it to your needs.
Hope this helps
-Andreas
Just saw your Edit. You Basically want a vertical linear layout with a horizontal linear layout on top then a list view and another linear horizontal layout on the bottom.
精彩评论