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:
Thanks for the clean example Ravi... Even this http://www.compiletimeerror.com/2013/06/android-linearlayout-example.html might help.. Have a look..
ReplyDelete