I want to have "Sign in with Google" button with white background and colored icon, but when I use this Google icon always gets tinted.
<android.support.design.button.MaterialButton
style="@style/Widget.MaterialComponents.Button.Icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Sign in with Google"
app:icon="@drawable/ic_google_colored"/>
How do I make icon not tinted?
I already found a solution, I just changed iconTintMode
and iconTint color
<android.support.design.button.MaterialButton
style="@style/Widget.MaterialComponents.Button.Icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Sign in with Google"
app:icon="@drawable/ic_google_colored"
app:iconTint="@android:color/transparent"
app:iconTintMode="add"/>
I am open to better solutions
Use this and quit tint icon to show real color
app:icon="@drawable/ic_google"
app:iconTint="@null"
Example
<Button
android:id="@+id/idGoogle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:icon="@drawable/ic_google"
app:iconTint="@null"/>
icon with real color shows black background
You can also use white color as iconTint and use multiply as iconTintMode for colorful icons.
app:iconTint="@color/white"
app:iconTintMode="multiply"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With