用Android Studio中设置activity的theme时候出现的问题:
java.lang.illegalStateException : you need to use a theme.appCompat theme(or descendant) with this activity.
出现这种问题原因是:你的布局xml文件有 support-V7 上的控件, 而你的AndroidManifest里的该activity的theme名字写成这种形式(或者其他形式),如:<style name="translucent"> (错误写法)
正确的是<style name="translucent">里的name要前要添加 AppTheme,如:
<style name="AppTheme.translucent"> (正确写法)
【否则会报出这种错误:You need to use a Theme.AppCompat theme (or descendant) with the design library.】如(AndroidManifest.xml):<activity android:name=".ui.activity.NewsCommentActivity" android:theme="@style/AppTheme.translucent" />
translucent是我在style.xml写的一个stlye,如:<style name="AppTheme.translucent" > <item name="windowActionBar">false</item> <item name="windowNoTitle">true</item> </style>
在编程Android应用时遇到一个错误,表现为java.lang.IllegalStateException,提示需要使用theme.appCompat主题或其子主题。该错误表明当前活动(activity)配置的主题不兼容AppCompatActivity。

被折叠的 条评论
为什么被折叠?



