I have created activity but both have different look.
Image of Nexsus 10
Image of 320 x 480 Image
At first image it shows too much spaces at bottom . how can I resolve that problem ? How do i make that responsive.
Thank you in advance
I have created activity but both have different look.
Image of Nexsus 10
Image of 320 x 480 Image
At first image it shows too much spaces at bottom . how can I resolve that problem ? How do i make that responsive.
Thank you in advance
Checkout this
Basically:
keep diffrent versions of your layout in folders in example
layout-hdpi
layout-mdpi
layout-other_selector_that_you_want
etc
You will need to make the login page for both handset and tablet devices, and tweak the layouts accordingly.
The simplest case would be to have the layout for the smartphones stored in res/layout/login.xml
and for the tablets in res/layout-large/login.xml
Having these layouts separated, try to add some padding for the layout of tablet version and center the layout in the middle of the screen, I believe it will look much better.
(if you don't have the folder layout-large
in res
directory, you will need to create it manually)
Well it seems you are wrapping height. If you are talking about ratios You should use weight in your layout instead of wrapping height.
Demo code
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:text="Login"
android:gravity="center"/>
<ImageView android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="2"
android:src="@drawable/ic_launcher"
android:gravity="center"/>
<EditText android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:hint="Enter User Name"/>
<EditText android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:hint="Enter Password"/>
<TextView android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="2"
android:text="Large Text"
android:gravity="center_vertical"/>
<Button android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:text="Login"/>
<View android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"/>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:orientation="horizontal">
<Button android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="Register"/>
<Button android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="Help"/>
</LinearLayout>
<View android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"/>
</LinearLayout>