EF's Blog

Android Tutorial : Layout Width for LinearLayout/TableRow/Object with Percentage

Posted on: May 21, 2012

For example :

<TableRow
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:layout_gravity=”center_vertical”
android:background=”@drawable/epolicy_menu_nab_barbackground”
android:weightSum=”1″
>
<TextView
android:id=”@+id/tvNABColumnJenis”
android:text=”@string/strNABColumnJenis”
style=”@style/size10ptWhite3dpBold”
android:layout_weight=”.45″
android:layout_width=”0dp”
/>
<TextView
android:id=”@+id/tvNABColumnPerubahan”
android:text=”@string/strNABColumnPerubahan”
style=”@style/size10ptWhite3dpBold”
android:layout_weight=”.21″
android:layout_width=”0dp”
/>
<TextView
android:id=”@+id/tvNABColumnDalam3Hari”
android:text=”@string/strNABColumnDalam3Hari”
style=”@style/size10ptWhite3dpBold”
android:layout_weight=”.34″
android:layout_width=”0dp”
/>
</TableRow>

these parameters :

android:weightsum=”1″

and 

android:width=”0dp”

is a must.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

EF’s Blog

I'm just ordinary people who lived in an extra-ordinary world.

EF's Blog Stats

  • 126,564 hits
May 2012
M T W T F S S
« Apr   Jul »
 123456
78910111213
14151617181920
21222324252627
28293031  

Archives

%d bloggers like this: