androidkotlinandroid-buttonmaterial-components-androidmaterialbutton

Android Material Button with Icon on top of Text


Is it possible to have a material button with an icon on top of its text as such:

Buttons

If yes, can you please explain how with some code?

Thank you.


Solution

  • Now you can use the attribute iconGravity="top".

    Something like:

    <com.google.android.material.button.MaterialButton
        app:icon="@drawable/...."
        app:iconGravity="top" />
    

    enter image description here

    Note: It requires at least the version 1.3.0-alpha02.