尽管已经使用了Theme.AppCompat主题,但您需要将Theme.AppCompat主题(或后代)与此活动一起使用

时间:2018-04-17 12:51:02

标签: android android-appcompat android-styles

我正在尝试使用FrescoImageViewer以全屏显示图像,但是当我尝试这样做时,我得到了这个刺激

java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
    at android.support.v7.app.AppCompatDelegateImplV9.createSubDecor(AppCompatDelegateImplV9.java:354)
    at android.support.v7.app.AppCompatDelegateImplV9.ensureSubDecor(AppCompatDelegateImplV9.java:323)
    at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:284)
    at android.support.v7.app.AppCompatDialog.setContentView(AppCompatDialog.java:83)
    at android.support.v7.app.AlertController.installContent(AlertController.java:231)
    at android.support.v7.app.AlertDialog.onCreate(AlertDialog.java:278)
    at android.app.Dialog.dispatchOnCreate(Dialog.java:403)
    at android.app.Dialog.show(Dialog.java:302)
    at com.stfalcon.frescoimageviewer.ImageViewer.show(ImageViewer.java:61)
    at com.stfalcon.frescoimageviewer.ImageViewer$Builder.show(ImageViewer.java:435)
    at me.lkp111138.social_platform.activity.PostViewActivity$5.onClick(PostViewActivity.java:258)
    at android.view.View.performClick(View.java:6294)
    at android.view.View$PerformClick.run(View.java:24770)
    at android.os.Handler.handleCallback(Handler.java:790)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6494)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

事实上,我在应用中为我的所有活动使用的主题是@style/AppTheme@style/AppTheme.NoActionBar@style/AppTheme用于我呼叫观众的活动。

这是styles.xml

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="android:windowTitleSize">40dp</item>
        <item name="windowActionBar">true</item>
    </style>

    <style name="AppTheme.NoActionBar" parent="AppTheme">
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
        <item name="android:windowTitleSize">40dp</item>
    </style>

    <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

    <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

</resources>

任何帮助将不胜感激!

0 个答案:

没有答案