android button fine text alignment
21,639
My mistake, padding was working correctly. Just didn't appear to be.
Author by
skorulis
I'm a mobile application developer currently focusing on Android and iPhone.
Updated on December 19, 2020Comments
-
skorulis over 3 years
I'm trying to create standard button in android with a background and some text in front but some fairly specific alignment. I want the text to be centered vertically and on the left with 20dp of padding. The alignment works but the padding doesn't. I know I could probably get the desired effect by putting a few spaces in the text but that seems like a hack and next I want to do a similar thing but with the text at the top so I would prefer a more elegant solution. Here's what I have:
<Button android:layout_width="312dp" android:layout_height="95dp" android:id="@+id/gv_music_button" android:text="Music" android:textSize="30sp" android:paddingLeft="20dp" android:gravity="left|center_vertical" />