• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Button Not coming in Center

 
Sahil Reddy
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using the following layout..... but after long try , i am unable to center the button... Could anyone please let me know the mistake i am doing here.....

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/softkeyview" android:layout_width="match_parent"
android:layout_height="59.33dp" android:paddingLeft="3.33dp"
android:paddingTop="6.67dp" android:paddingRight="3.33dp"
android:weightSum="2" android:paddingBottom="2.67dp"
android:background="@drawable/winset_softkey_bg">

<Button android:layout_height="wrap_content" android:ellipsize="marquee"
android:layout_width="wrap_content" android:layout_weight="1"
android:singleLine="true" android:textSize="16dp" android:gravity="center"
android:id="@+id/softkeyleft" />

</LinearLayout>
 
Przemek Boryka
Ranch Hand
Posts: 51
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi !


Maybe you should try put the button in the tableRow and set the gravit of tableRow to center_horizontal
Bye .. sorry for my english !! Im still learning !
 
Przemek Boryka
Ranch Hand
Posts: 51
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi again

Try with this:



I think it should help you
 
Sahil Reddy
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot , first one worked :-)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic