Issue
How can I get a material button in android? I have tried this code but don't know how to include an image like this:
<com.google.android.material.button.MaterialButton
android:id="@+id/material_button"
style="@style/Widget.MaterialComponents.Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Add to Cart"/>
Solution
For Material Button
use icon
and iconGravity
properties like below:
<com.google.android.material.button.MaterialButton
style="@style/Widget.MaterialComponents.Button.Icon"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Icon Button"
app:icon="@drawable/your_icon"
app:iconGravity="textStart"/>
Go through docs for better understanding:Here
Answered By - Sumit Shukla
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.