i have created an application in 2.2 version, if i run it in normal phone it works fine. but in tablet still it works fine but the label, textveiw and other things remain in the same size of the mobile phone.
I have used this code but its is not working.
<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true" />
Is their any other wayto do so, that my application look good in tablet tooo.
my xml code, and i am using it inside table layout
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:id="@+id/mainlayout"
android:background="#ffffff" android:fadingEdge="horizontal|vertical"
>
<RelativeLayout android:id="@+id/header_login"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#000000"
android:gravity="center"
android:orientation="horizontal" >
<ImageView android:id="@+id/login_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:paddingBottom="5px"
android:paddingLeft="3px"
android:paddingTop="5px"
android:src="@drawable/sap_new" />
</RelativeLayout>
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingTop="5dip"
android:src="@drawable/login1" >
</ImageView>
<TableRow android:gravity="center" android:paddingTop="15px" android:layout_width="fill_parent">
<TextView android:text="Username " android:layout_column="0" android:textColor="#000000" android:id="@+id/usrLbl"
android:layout_width="wrap_content" android:gravity="right" />
<TextView android:text="" android:layout_column="1"
android:gravity="left" android:width="20dip" android:textColor="#FF0000" />
<EditText android:id="@+id/sapuser" android:hint="Required"
android:layout_column="2" android:width="150dip" android:paddingLeft="5dip"
android:layout_marginRight="15dip" android:text="" android:singleLine="true" />
</TableRow>
<TableRow android:gravity="center" android:layout_width="fill_parent">
<TextView android:text="Password " android:layout_column="0" android:textColor="#000000"
android:gravity="right" android:id="@+id/passLbl" />
<TextView android:text="" android:layout_column="1"
android:gravity="left" android:textColor="#FF0000" />
<EditText android:id="@+id/password" android:hint="Required"
android:paddingLeft="5dip" android:layout_column="2"
android:password="true" android:text=""
android:singleLine="true" android:layout_marginRight="15dip" />
</TableRow>
<TableRow android:gravity="center" android:layout_width="fill_parent">
<TextView android:text="" android:layout_column="0"
android:gravity="right" />
<TextView android:text="" android:layout_column="1"
android:gravity="left" android:textColor="#FF0000" />
<CheckBox
android:id="@+id/ShowPassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15dp"
android:text="Show Password" android:textColor="#000000" android:background="@drawable/checkbox_background" android:button="@drawable/checkbox" />
</TableRow>
<TableRow android:gravity="center" android:layout_width="fill_parent">
<TextView android:text="" android:layout_column="0"
android:gravity="right" />
<TextView android:text="" android:layout_column="1"
android:gravity="left" android:textColor="#FF0000" />
<CheckBox
android:id="@+id/SavePassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15dp"
android:text="Save Password" android:textColor="#000000" android:background="@drawable/checkbox_background" android:button="@drawable/checkbox" />
</TableRow>
<LinearLayout android:paddingTop="10px" android:layout_width="fill_parent" android:gravity="center_horizontal">
<Button android:layout_width="wrap_content" android:id="@+id/submit"
android:layout_height="wrap_content" android:text="Login"
android:gravity="center" />
</LinearLayout>
</TableLayout>
You should create value/dimens.xml file for mobile and value-sw600dp/dimes.xml for tablet. Next you should write down there different dimensions for each item in your layout. Like this:
File values/dimens.xml :
File values-sw600dp/dimens.xml
After that you should write down references on dimensions. For example
Note that for 7 inch and 10 inch you should use different values: