[英]Error :java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity
<activity
android:name="com.luckyxmobile.timers4meplus.activity.WidgetConfigActivity"
android:theme="@style/Theme.PageIndicator.Dark">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
<category android:name="com.jakewharton.android.viewpagerindicator.sample.SAMPLE" />
</intent-filter>
</activity>
<style name="Theme.PageIndicator.Dark" parent="android:Theme">
<item name="tpi_tabPadding">12dp</item>
<item name="tpi_tabRipple">@style/DarkTabRippleStyle</item>
<item name="tpi_indicatorHeight">3dp</item>
<item name="tpi_indicatorColor">@color/colorPrimary</item>
<item name="android:textAppearance">@style/DarkTabTextAppearance</item>
<item name="android:background">@color/colorAccent</item>
<item name="tpi_mode">scroll</item>
</style>
The above is theme and style.When I run the app,show this error. 以上是主题和样式。当我运行应用程序时,显示此错误。 I think maybe it should be "Theme.AppCompat" not "android:Theme",but not sure! 我认为可能应该是“ Theme.AppCompat”而不是“ android:Theme”,但不确定!
Whats your logcat throws 你的logcat抛出了什么
Error :java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity
I guess, you need to extends AppCompatActivity
我想,您需要扩展AppCompatActivity
public class WidgetConfigActivity extends AppCompatActivity {
// ...
}
AppCompatActivity is from the appcompat-v7 library. AppCompatActivity来自appcompat-v7库。 Principally, this offers a backport of the action bar. 原则上,这提供了操作栏的反向移植。 Since the native action bar was added in API Level 11, you do not need AppCompatActivity for that. 由于本机操作栏是在API级别11中添加的,因此您不需要AppCompatActivity。 However, current versions of appcompat-v7 also add a limited backport of the Material Design aesthetic, in terms of the action bar and various widgets. 但是,就动作栏和各种小部件而言,当前版本的appcompat-v7还增加了有限的Material Design美学支持。
You can use Theme.AppCompat
instead of android:Theme
. 您可以使用Theme.AppCompat
代替android:Theme
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.