I changed the color of materialButton in themes.xml by overlaying the default theme:
<style name="ShapeAppearanceOverlay.Roomie.Button" parent="Widget.MaterialComponents.Button">
<item name="cornerFamily">rounded</item>
<item name="colorPrimary">#C4C4C4</item>
<item name="cornerSize">50%</item>
</style>
<style name="IncrementButtonTheme" parent="Widget.MaterialComponents.Button">
<item name="materialThemeOverlay">@style/ShapeAppearanceOverlay.Roomie.Button</item>
</style>
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_plus"
style="@style/IncrementButtonTheme"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginTop="5dp"
android:gravity="center"
android:insetLeft="0dp"
android:insetTop="0dp"
android:insetRight="0dp"
android:insetBottom="0dp"
android:onClick="increment"
app:icon="@drawable/ic_plus"
app:iconGravity="textStart"
app:iconPadding="0dp"
app:iconSize="30dp"
app:layout_constraintHorizontal_weight="5"
app:layout_constraintBottom_toTopOf="@+id/btn_zapisz_produkt"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/ilosc"
app:layout_constraintTop_toBottomOf="@id/nazwa_marki"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.Roomie.Button" />
But now i want to set another background color for when it's pressed on. How can I do that?
You can try this one: