Provide layout for different screen size
package com.examples.universal; import android.app.Activity; import android.os.Bundle; public class UniversalActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } } //main.xml <?xml version="1.0" encoding="utf-8"?> <!-- PORTRAIT/DEFAULT LAYOUT --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="This is a vertical layout for PORTRAIT" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button One" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button Two" /> </LinearLayout> //layout-land/main.xml <?xml version="1.0" encoding="utf-8"?> <!-- LANDSCAPE LAYOUT --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="The is a horizontal layout for LANDSCAPE" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button One" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button Two" /> </LinearLayout> //layout-large/main.xml <?xml version="1.0" encoding="utf-8"?> <!-- LARGE LAYOUT --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="This is the layout for TABLETS" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button One" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button Two" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button Three" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button Four" /> </LinearLayout>