Wednesday, April 10, 2013

[android help] Android Button Alignment using Table Layout

Android Button Alignment using Table Layout - Stack Overflow




















I was trying three buttons to keep aligned using Table Row, But the middle one remains in air, any idea what am i missing ?



android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="bottom"
android:stretchColumns="*">

android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:gravity="center_horizontal">

android:id="@+id/btnManualLookup" android:text="ABC"
android:layout_weight="1"
android:textColor="#000000"
android:padding="20dip" android:gravity="center"/>

android:id="@+id/downloadcerti" android:text="DEF"
android:layout_weight="1"
android:textColor="#000000"
android:padding="20dip" android:gravity="center"/>

android:id="@+id/settingsbutton" android:text="GHI"
android:layout_weight="1"
android:textColor="#000000"
android:padding="20dip" android:gravity="center"/>



Couldn't attach snapshot but giving some hint below by drawing. The first and third button are perfect but middle one remains little bit up from bottom. Any idea ?



**********************************
* *
* ABC DEF GHI *
* ************ *
************ ************




























try using this



android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="bottom"
android:stretchColumns="*">

android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:gravity="center_horizontal">

android:id="@+id/btnManualLookup" android:text="ABC"
android:height="wrap_content"
android:width="0dp"
android:layout_weight="1"
android:textColor="#000000"
android:padding="20dip" android:gravity="center"/>

android:id="@+id/downloadcerti" android:text="DEF"
android:height="wrap_content"
android:width="0dp"
android:layout_weight="1"
android:textColor="#000000"
android:padding="20dip" android:gravity="center"/>

android:id="@+id/settingsbutton" android:text="GHI"
android:height="wrap_content"
android:width="0dp"
android:layout_weight="1"
android:textColor="#000000"
android:padding="20dip" android:gravity="center"/>




















default







.

stackoverflow.comm

No comments:

Post a Comment

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...