2

Is there a way to use the extended floating action button when your parent style is set to "Theme.AppCompat.Light.NoActionBar"?

I have the following in my layout. The app crashes because of style issue when my parent style is set to AppCompat.

<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
    android:id="@+id/viewMore"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="end|bottom"
    android:layout_margin="16dp"
    android:text="View More"
    android:textColor="@color/colorPrimary"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"/>
Karu
  • 935
  • 2
  • 13
  • 32

1 Answers1

2

As suggested here, you could use a Material bridge theme to retain the AppCompat style.

<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar.Bridge">
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>
rogue
  • 341
  • 3
  • 7