Image + Text to be centre alligned in button
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
I have a Button with its width as Note:This link is not solving my problem. I am attaching my button portion of xml
After adding these attribute my text is coming on center but image/icon is still on left side of button. Can any body help!!! | ||||
You might want to check my answer to this question: Android Button with text and image Its an ugly solution but it you want the image and text to be centered as a group in the button rather than text center and drawable padded from the side then its the only way I have found. | |||
Use layout gravity attribute as follows
if above not working the put this button in a linear layout and inside the linear layout put gravity attribute. That will surely work. please share your knowledge if its not working. | |||
default
Read more
stackoverflow.comm
No comments:
Post a Comment