Reputation: 1815
Create a MaterialButton
with following attributes:
<com.google.android.material.button.MaterialButton
android:id="@+id/btn1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
app:icon="@drawable/ic_star"
app:iconGravity="textStart"
app:iconPadding="0dp" />
When updating the text to a short text, like "123", that does not change the width of the button, the icon does not align properly and may overlap the text. But if the text is long enough, like "123456789", to change the button's width, everything is alright.
It is more obvious when iconPadding
is set to a small number like zero. In the gif above iconPadding
is 2.
Android API version:
API 21, 26, 29
Material Library version:
com.google.android.material:material:1.6.0-alpha02
Am I doing something wrong? or this is a bug.
How can I resolve this issue?
Upvotes: 1
Views: 465