File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Android and the fly likes Button Not coming in Center Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "Button Not coming in Center" Watch "Button Not coming in Center" New topic
Author

Button Not coming in Center

Sahil Reddy
Ranch Hand

Joined: Jan 24, 2011
Posts: 145
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

Joined: Dec 06, 2011
Posts: 51

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

Joined: Dec 06, 2011
Posts: 51

Hi again

Try with this:



I think it should help you
Sahil Reddy
Ranch Hand

Joined: Jan 24, 2011
Posts: 145
Thanks a lot , first one worked :-)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Button Not coming in Center
 
Similar Threads
ScrollBar Not activated
how to call button inside a slidingDrawer
Layouts, bottom position
when i change android:orientation to horizontal it shows blank screen
how to put layout in middle of the screen?