Issue
I wanted to put the icon on top of the materialButton like shown here:
But I couldn't find any properties in MaterialButton to set the gravity of the app:icon to top. I could only able to set it to start or end. Is there any way to set the create a similar button without using Vertical LinearLayout with ImageView and TextView?
Solution
You can use the iconGravity="textTop"
.
<com.google.android.material.button.MaterialButton
style="@style/Widget.MaterialComponents.Button.TextButton"
app:icon="@drawable/ic_add_24px"
app:iconGravity="textTop" />
Note: It requires at least the version 1.3.0-alpha02
.
Answered By - Gabriele Mariotti
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.