Tuesday 17 November 2015

Display four square layout in andriod using linear layout.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="150dp">
    <LinearLayout android:orientation="horizontal" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.5">
        <ImageButton android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/imageButton71" android:layout_gravity="center_horizontal" android:src="@drawable/sadas" />
    </LinearLayout>
    <LinearLayout android:orientation="vertical" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.5">
        <LinearLayout android:orientation="horizontal" android:layout_width="wrap_content" android:layout_weight="1" android:layout_height="75dp">
            <LinearLayout android:orientation="horizontal" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.5">
                <ImageButton android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/imageButton1" android:layout_gravity="center_horizontal" android:src="@drawable/sadas" />
            </LinearLayout>
            <LinearLayout android:orientation="horizontal" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.5">
                <ImageButton android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/imageButton" android:src="@drawable/wreew" android:layout_gravity="center_horizontal" />
            </LinearLayout>
        </LinearLayout>
        <LinearLayout android:orientation="horizontal" android:layout_width="match_parent" android:layout_weight="1" android:layout_height="75dp">
            <LinearLayout android:orientation="horizontal" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.5">
                <ImageButton android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/imageButton21" android:layout_gravity="center_horizontal" android:src="@drawable/sadas" />
            </LinearLayout>
            <LinearLayout android:orientation="horizontal" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.5">
                <ImageButton android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/imageButton22" android:src="@drawable/wreew" android:layout_gravity="center_horizontal" />
            </LinearLayout>
        </LinearLayout>
    </LinearLayout>
</LinearLayout>

Featured post

How to convert Java object to JSON or JSON to java object in java

Download Gson jar from this link  Quick Reference toJson() – Convert Java object to JSON Gson gson = new Gson ( ) ; <Java cla...