Issue
I am using the following material button:
<android.support.design.button.MaterialButton
android:id="@+id/bFavourite" style="@style/Widget.MaterialComponents.Button.UnelevatedButton.Icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:insetTop="0dp"
android:insetBottom="0dp"
android:textAllCaps="false"
android:textSize="20sp"
app:backgroundTint="@color/main_dark_blue"
app:backgroundTintMode="src_over"
app:cornerRadius="0dp"
app:icon="@drawable/heart_filled"
app:iconGravity="textStart"
app:iconPadding="0dp" />
heart_filled
is a png of a red heart. However the icon is showing without any color (i.e., a white heart).
Why is the actual color of the image not showing?
Thank you
Solution
Maybe you are looking for this set iconTint
to null
<com.google.android.material.button.MaterialButton
android:id="@+id/btnGoogle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginStart="@dimen/_2sdp"
android:layout_weight="1"
app:icon="@drawable/ic_google"
app:iconGravity="textStart"
app:iconTint="@null"
android:elevation="@dimen/_10sdp"
android:text="@string/string_google"
android:textAllCaps="false"
app:rippleColor="@color/colorBlueShade1"
app:cornerRadius="@dimen/_20sdp"
app:backgroundTint="@color/colorWhite"
android:textColor="@color/colorPrimary" />
Answered By - Shrenik Shah
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.