Android studio 3.1 XML preview not showing for some XML layouts

后端 未结 15 825
时光取名叫无心
时光取名叫无心 2020-12-08 02:54

Some layouts are shown, some just have blank, gray frame. I can\'t seem to find a correlation between XML layouts that work and those that do not, there is a mixture of use

相关标签:
15条回答
  • 2020-12-08 03:50

    Open your styles.xml file.

    <!-- 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>
    </style>
    

    That was an issue in Android Studio 3.1. Now in 3.4, there are no issues like that. So, it is recommended to keep up to date the Android Studio with the latest version.

    0 讨论(0)
  • 2020-12-08 03:54

    You can change your dependency in build.gradle(module)

    from

    implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
    

    to

    implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
    
    0 讨论(0)
  • 2020-12-08 03:55

    All you had to do is go to styles.xml file and replace your parent theme from Theme.AppCompat.Light.DarkActionBar to Base.Theme.AppCompat.Light.DarkActionBar

    Append Base to the default parent style

    0 讨论(0)
提交回复
热议问题