Issue
I am trying to set drawable in my button but its not showing properly. Here is what I want to achieve
but I am unable to get the required results.
This is what I am doing
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnShareStore"
style="@style/yellowButton"
android:layout_marginTop="@dimen/margin_large"
android:layout_marginBottom="@dimen/margin_small"
android:layout_weight="1"
android:drawableStart="@drawable/ic_vector_share"
android:text="@string/lbl_share_store"
android:layout_marginStart="@dimen/margin_large"
android:layout_marginEnd="@dimen/margin_small"/>
and this is how it looks like
How can I move drawable to the adjacent left side of text?
Any help will be highly appreciated
Solution
You can try with this, keep in mind that it will need your app theme to be a descendant of MaterialTheme
.
<com.google.android.material.button.MaterialButton
app:icon="@drawable/icon_search"
android:text="Hello"
app:iconGravity="textStart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
Answered By - rahat
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.