简体   繁体   English

错误:java.lang.IllegalStateException:您需要在此活动中使用Theme.AppCompat主题(或后代)

[英]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.

相关问题 java.lang.IllegalStateException:您需要在此活动中使用Theme.AppCompat主题(或后代) - java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity java.lang.IllegalStateException您需要在此活动中使用Theme.AppCompat主题(或后代) - java.lang.IllegalStateException You need to use a Theme.AppCompat theme (or descendant) with this activity java.lang.IllegalStateException:您需要在此活动中使用 Theme.AppCompat 主题(或后代)。 钛 - java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. titanium Firebase java.lang.IllegalStateException:您需要在此活动中使用Theme.AppCompat主题(或后代) - Firebase java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity java.lang.IllegalStateException:此活动需要使用Theme.AppCompat主题(或后代) - java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity 外部库用法-&gt; java.lang.IllegalStateException:您需要在此活动中使用Theme.AppCompat主题(或后代) - external library usage --> java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity 如何解决:java.lang.IllegalStateException:您需要在此活动中使用 Theme.AppCompat 主题(或后代)? - How to resolve: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity? Android:java.lang.IllegalStateException:您需要在此活动中使用Theme.AppCompat主题(或后代) - Android: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity java.lang.IllegalStateException:您需要在 Flutter App 中使用 Theme.AppCompat 主题(或后代)与此活动 - java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity in Flutter App 定制主题android崩溃原因:java.lang.IllegalStateException:您需要在此活动中使用Theme.AppCompat主题(或后代) - Crash with custom theme android Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM