版权声明:本文为博主原创文章,未经博主允许不得转载: https://mp.youkuaiyun.com/postedit/83107811
更新as到3.0.1后 布局文件的Design无法预览布局,显示空白
在网上找到个办法:
修改res/values/styles.xml文件中name=“AppTheme”的style,在Theme.AppCompat.Light.DarkActionBar前面添加Base.如下所示:
<resources> <!-- Base application theme. --> <style name="AppTheme" parent="Base.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> </resources>
这样其他AppCompat依赖包里的东西还不能用,在build.gradle里把依赖API28改为26即可
android { compileSdkVersion 26 defaultConfig { applicationId "com.example.yangzhan.popuwindtest" minSdkVersion 24 targetSdkVersion 28 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } }
同时修改依赖
implementation 'com.android.support:appcompat-v7:26.0.0'
就又能显示布局文件了,记录下这些骚操作