How to center icon and text in a android button with width set to “fill parent”?

I think android:gravity= "centre" should work.

Try to use android:drawableTop="@drawable/start" instead. Or do you want to have the drawable on the left side of the text but centered?

Yes I want the drawable on the left side of the text, and both centered in the button. Thanks. – user438775 Sep 3 '10 at 10:03.

I had the same problem try this, it worked for me.

Android:gravity="center" centers all content on both X and Y axis – Kyle Meadows May 28 at 14:36 But it is wrap_content for height... – Howard Hodson Oct 19 at 1:15.

I know this question is a bit older, but perhaps you're still open for hints or workarounds: Create a RelativeLayout "wrap_content" with the button image as the background or the button itself as the first element of the layout. Get a LinearLayout and set it to "layout_centerInParent" and "wrap_content". Then set your Drawable as an Imageview.At last set a TextView with your text (locale).

So basically you have this structure: RelativeLayout Button LinearLayout ImageView TextView or like this: RelativeLayout with "android-specific" button image as background LinearLayout ImageView TextView I know with this solution there are many elements to deal with, but you can create very easy your own custom button with it and also set the exact position of text and drawables :).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions