问题
<!-- 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.
回答1:
You need to use one theme of the AppCompact library like @style/Theme.AppCompat.Light instead of android:Theme.Material.Light.NoActionBar
回答2:
In your Android Studio, click on the "theme button" and select the appCompat theme in the dialog.
来源:https://stackoverflow.com/questions/32376815/illegalstateexception-you-need-to-use-a-theme-appcompat-theme-or-descendant