Linear Layout (Horizontal & Vertical) in Android


android program:

Linear Layout (Horizontal & Vertical) in Android


open project >res>layout>main.xml and edit as below






<?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" >
    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="1">
    <Button
        android:text="one"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>
    <Button
        android:text="two"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>
    <Button
        android:text="three"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>
                        
     </LinearLayout>
    <LinearLayout
        android:orientation="vertical"
        android:layout_weight="1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        >


    <TextView
        android:textSize="15pt"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="#aaaa00"
        android:text="one" />
    <TextView
        android:textSize="15pt"
        android:text="two"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="#aa0000"
        />
    <TextView
        android:textSize="15pt"
        android:text="three"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="#00aa00"
        />
    </LinearLayout>


</LinearLayout>


output:



Comments

Post a Comment

Popular posts from this blog

MVC Adding 2 Numbers Program

Relative Layout in android UI Design

Button Clicking -Perform Action in android