I want to override the default Snackbar style. I need to remove all margins and other stuff.
What I am current doing is:
My activity has a custom theme in my AndroidManifest.xml
<activity android:name="activity.MyActivity"
android:screenOrientation="portrait"
android:fitsSystemWindows="true"
android:windowSoftInputMode="adjustResize|stateHidden"
android:theme="@style/AppThemeLight"/>
In styles.xml I'm trying to override the snackbarStyle for this custom Theme:
<style name="AppThemeLight" parent="Theme.MaterialComponents.Light.NoActionBar">
....
<item name="snackbarStyle">@style/MaterialSnackbarTheme</item>
</style>
<style name="MaterialSnackbarTheme" parent="@style/Widget.MaterialComponents.Snackbar">
<item name="backgroundTint">#00cc77</item>
<item name="android:background">#00cc77</item>
<item name="cornerRadius">0dp</item>
<item name="android:layout_margin">0dp</item>
<item name="actionTextColorAlpha">1.0</item>
<item name="android:layout_marginStart">0dp</item>
<item name="android:layout_marginEnd">0dp</item>
<item name="android:layout_marginBottom">0dp</item>
<item name="android:layout_marginTop">0dp</item>
</style>
But none of this change seems to have effect, when showing a Snackbar, the style is always the default:
The code I used to create this example:
Snackbar.make(view, "Your message here", Snackbar.LENGTH_LONG).show()
What I am doing wrong?