I am building an Android app in which there is a list of items in a gridview, and I would like the user to select any of them.I do not want to use a radio group/radios, but an icon and a name of the item next to it.
Once the user has selected something, I 开发者_开发技巧have three buttons at the bottom, back, cancel and set as default.
The problem is arranging this stuff so that it appears fine on a landscape mode as well as portrait mode.
Can someone suggest a good layout skeleton?
Here is the Android layout file content
<?xml version="1.0" encoding="utf-8"?><RelativeLayoutandroid:id="@+id/widget30"android:layout_width="fill_parent"android:layout_height="fill_parent"xmlns:android="http://schemas.android.com/apk/res/android"><GridView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/GridView01" android:layout_width="fill_parent" android:layout_height="370dip" android:numColumns="auto_fit" android:stretchMode="columnWidth" android:layout_alignParentTop="true" android:gravity="center"></GridView><Buttonandroid:id="@+id/back"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text=" Back "android:layout_alignParentBottom="true"android:layout_alignParentLeft="true"android:layout_below="@+id/GridView01"></Button><Buttonandroid:id="@+id/setDefault"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text=" Set as Default "android:layout_alignParentBottom="true"android:layout_toLeftOf="@+id/cancel"android:layout_below="@+id/GridView01"></Button><Buttonandroid:id="@+id/cancel"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text=" Cancel "android:layout_alignParentBottom="true"android:layout_alignParentRight="true"android:layout_below="@+id/GridView01"></Button></RelativeLayout>
Use Relative Layout,Click Here to know how to use Relative Layout.
精彩评论