<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:app="http://schemas.android.com/apk/res-auto"

    xmlns:tools="http://schemas.android.com/tools"

    and" />

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:app="http://schemas.android.com/apk/res-auto"

    xmlns:tools="http://schemas.android.com/tools"

    and" />

info@thistimebd.com

Monday 29th of April 03:43:13am

layout Weight Android app Source Code

activity_main.xml

----------------


<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:app="http://schemas.android.com/apk/res-auto"

    xmlns:tools="http://schemas.android.com/tools"

    android:layout_width="match_parent"

    android:layout_height="match_parent"

    android:orientation="vertical"

    android:weightSum="5"

    tools:context="com.tis.web.layoutweight.MainActivity">


<Button

    android:layout_weight="1"

    android:text="button1"

    android:id="@+id/button1Id"

    android:layout_width="match_parent"

    android:layout_height="0dp"

    style="@style/Widget.AppCompat.Button.Colored"

    />

<Button

    android:layout_weight="1"

    android:text="button2"

    android:id="@+id/button2Id"

    android:layout_width="match_parent"

    android:layout_height="0dp"

    style="@style/Widget.AppCompat.Button.Colored"

    />

<Button

    android:layout_weight="1"

    android:text="button3"

    android:id="@+id/button3Id"

    android:layout_width="match_parent"

    android:layout_height="0dp"

    style="@style/Widget.AppCompat.Button.Colored"

    />

<Button

    android:layout_weight="1"

    android:text="button4"

    android:id="@+id/button4Id"

    android:layout_width="match_parent"

    android:layout_height="0dp"

    style="@style/Widget.AppCompat.Button.Colored"

    />

<Button

    android:layout_weight="1"

    android:text="button5"

    android:id="@+id/button5Id"

    android:layout_width="match_parent"

    android:layout_height="0dp"

    style="@style/Widget.AppCompat.Button.Colored"

    />


</LinearLayout>

======================================================================================


activity_main.xml

----------------

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:app="http://schemas.android.com/apk/res-auto"

    xmlns:tools="http://schemas.android.com/tools"

    android:layout_width="match_parent"

    android:layout_height="match_parent"

    android:orientation="vertical"

    android:weightSum="3"

    tools:context="com.tis.web.layoutweight.MainActivity">



    <LinearLayout

        android:background="#ff22"

        android:layout_weight="1"

        android:layout_width="match_parent"

        android:layout_height="0dp"></LinearLayout>



    <LinearLayout

        android:background="#e1c8c8"

        android:layout_weight="1"

        android:layout_width="match_parent"

        android:layout_height="0dp"></LinearLayout>



    <LinearLayout

        android:background="#1cc22a"

        android:layout_weight="1"

        android:layout_width="match_parent"

        android:layout_height="0dp"></LinearLayout>




</LinearLayout>