xml - All Buttons Same Size, Center Text(Android) -


i have 6 buttons. xml follows each one. how go changing them button text centered , same size?

i assumed setting size trick?

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" >   <button  android:id="@+id/button1"  android.layout_height="100px" android.layout_width="60px" android:layout_height="wrap_content"  android:layout_width="wrap_content"  android:text="button1"/>   

you should use

android:layout_width="fill_parent" 

instead of

android:layout_width="wrap_content"  

in button attributes. button width can changed android:padding attribute in linearlayout example:

 <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"  android:orientation="vertical"  android:paddingleft="10px"  android:paddingright="10px"  android:layout_width="fill_parent"  android:layout_height="fill_parent"  >    <button   android:id="@+id/button1"   android:layout_height="wrap_content"   android:layout_width="fill_parent"   android:text="button1"/>  

Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -