I'm trying to create a facebook login button, something like this.
I have trouble setting the icon of the material button and also changing the button's background color at the same time. I am using a custom style in order to change the button's background color. I have also tried directly adding the backgroundTint property to my button but it is getting overriden by the theme's primaryColor. But then the when I set the icon property of the button the icon won't show.
This is my button
<com.google.android.material.button.MaterialButton
android:id="@+id/fb_login_button"
style="@style/orangeButtonStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/side_margin"
android:layout_marginTop="60dp"
android:layout_marginEnd="@dimen/side_margin"
android:layout_marginBottom="20dp"
android:text="@string/continue_with_facebook"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/login_link"
app:icon="@drawable/fb_icon"
app:iconTint="@color/white"
app:iconGravity="textStart"/>
And this is the style I'm using
<style name="orangeButtonStyle" parent="Widget.MaterialComponents.Button">
<item name="android:fontFamily">@font/semi_bold</item>
<item name="android:textColor">@color/white</item>
<item name="android:background">@drawable/orange_button_bg</item>
<item name="android:backgroundTint">@color/orange</item>
<item name="android:textSize">14sp</item>
<item name="android:textAllCaps">false</item>
<item name="android:layout_height">56dp</item>
<item name="android:layout_width">match_parent</item>
</style>
I've also tried changing my style's parent to Widget.AppCompat.Button. This will make the icon show but then the button's color doesn't change.