0

<!-- Base application theme. -->
<style name="AppTheme" parent="android:Theme.Material.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/ColorPrimary</item>
    <item name="colorPrimaryDark">@color/ColorPrimaryDark</item>
</style>

This is my code Showing error like this java.lang.RuntimeException: Unable to start activity ComponentInfo{com.colors.floatingactionbutton/com.colors.floatingactionbutton.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.

2 Answers2

3

You need to use one theme of the AppCompact library like @style/Theme.AppCompat.Light instead of android:Theme.Material.Light.NoActionBar

forcewill
  • 1,637
  • 2
  • 16
  • 31
0

enter image description here In your Android Studio, click on the "theme button" and select the appCompat theme in the dialog.

BustedSanta
  • 1,368
  • 7
  • 28
  • 55