Today I ran into a weird layout problem, and I did not find a useful answer from Google.
On my layout, I have a button with text on the left and an icon on the right. I want the text to be at 20dp from the left of the field to the border of the button, after which I set paddingLeft to the button, but it does not work. By chance, I set the background color for the button, and the cushion works like a charm. Anyone can help me explain this.
Layout below
<Buttonandroid:layout_width="fill_parent" android:drawableRight="@drawable/right_arrow" android:paddingLeft="20dp" android:paddingRight="20dp" android:layout_height="72dp" android:text="Button" android:id="@+id/btn" android:gravity="center_vertical" android:fontFamily="roboto regular" android:textColor="#ffffff00" style="@android:style/Widget.DeviceDefault.Button.Borderless" />
Thanks everyone!
source share