Layout Weight(Horizontal)

Posted by ITPangPang
2016. 5. 15. 22:14 Android/.xml


Layout Weight

(Horizontal)


ㆍLinearLayout

ㆍLeft TextView : Background(Black)

ㆍRight TextView : Background(Red)






<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="10"
android:orientation="horizontal">
<TextView
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="1"
android:textColor="#FFFFFF"
android:gravity="center"
android:text="1"
android:textSize="20dp"
android:background="#000000"
/>
<TextView
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="9"
android:background="#FF0000"
android:gravity="center"
android:text="9"
android:textSize="20dp"
/>
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="10"
android:orientation="horizontal">
<TextView
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="2"
android:textColor="#FFFFFF"
android:gravity="center"
android:text="2"
android:textSize="20dp"
android:background="#000000"
/>
<TextView
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="8"
android:background="#FF0000"
android:gravity="center"
android:text="8"
android:textSize="20dp"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="10"
android:orientation="horizontal">
<TextView
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="3"
android:textColor="#FFFFFF"
android:gravity="center"
android:text="3"
android:textSize="20dp"
android:background="#000000"
/>
<TextView
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="7"
android:background="#FF0000"
android:gravity="center"
android:text="7"
android:textSize="20dp"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="10"
android:orientation="horizontal">
<TextView
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="4"
android:textColor="#FFFFFF"
android:gravity="center"
android:text="4"
android:textSize="20dp"
android:background="#000000"
/>
<TextView
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="6"
android:background="#FF0000"
android:gravity="center"
android:text="6"
android:textSize="20dp"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="10"
android:orientation="horizontal">
<TextView
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="5"
android:textColor="#FFFFFF"
android:gravity="center"
android:text="5"
android:textSize="20dp"
android:background="#000000"
/>
<TextView
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="5"
android:background="#FF0000"
android:gravity="center"
android:text="5"
android:textSize="20dp"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="10"
android:orientation="horizontal">
<TextView
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="6"
android:textColor="#FFFFFF"
android:gravity="center"
android:text="6"
android:textSize="20dp"
android:background="#000000"
/>
<TextView
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="4"
android:background="#FF0000"
android:gravity="center"
android:text="4"
android:textSize="20dp"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="10"
android:orientation="horizontal">
<TextView
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="7"
android:textColor="#FFFFFF"
android:gravity="center"
android:text="7"
android:textSize="20dp"
android:background="#000000"
/>
<TextView
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="3"
android:background="#FF0000"
android:gravity="center"
android:text="3"
android:textSize="20dp"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="10"
android:orientation="horizontal">
<TextView
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="8"
android:textColor="#FFFFFF"
android:gravity="center"
android:text="8"
android:textSize="20dp"
android:background="#000000"
/>
<TextView
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="2"
android:background="#FF0000"
android:gravity="center"
android:text="2"
android:textSize="20dp"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="10"
android:orientation="horizontal">
<TextView
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="9"
android:textColor="#FFFFFF"
android:gravity="center"
android:text="9"
android:textSize="20dp"
android:background="#000000"
/>
<TextView
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="1"
android:background="#FF0000"
android:gravity="center"
android:text="1"
android:textSize="20dp"
/>
</LinearLayout>
</LinearLayout>



'Android > .xml' 카테고리의 다른 글

Layout Weight(Vertical)  (0) 2016.05.15
Shape Drawable(Oval)  (0) 2016.05.15
Shape Drawable(Line)  (0) 2016.05.15
Shape Drawable(Rectangle)  (0) 2016.05.15