fix: 修复 Android 16 上 libappbase 主题属性缺失导致的布局 inflate 崩溃

- 取消 Material 库依赖注释,修复 AppBarLayout 找不到类异常
- MyAppTheme 添加 themeDebug/toolbarBackgroundColor 等 libappbase 所需主题属性
- 新增 MyDebugActivityTheme,供 view_log.xml 的 android:theme 引用
- 添加 mainWindowBackgroundColor/mainWindowTextColor 等 5 个颜色资源
This commit is contained in:
LaizyBoy
2026-05-18 22:53:09 +08:00
parent 154595c713
commit 432bf9f0d7
3 changed files with 31 additions and 3 deletions

View File

@@ -59,7 +59,7 @@ dependencies {
// AndroidX 类库 // AndroidX 类库
api 'androidx.appcompat:appcompat:1.1.0' api 'androidx.appcompat:appcompat:1.1.0'
api 'androidx.cardview:cardview:1.0.0' api 'androidx.cardview:cardview:1.0.0'
//api 'com.google.android.material:material:1.4.0' api 'com.google.android.material:material:1.4.0'
//api 'androidx.viewpager:viewpager:1.0.0' //api 'androidx.viewpager:viewpager:1.0.0'
//api 'androidx.vectordrawable:vectordrawable:1.1.0' //api 'androidx.vectordrawable:vectordrawable:1.1.0'
//api 'androidx.vectordrawable:vectordrawable-animated:1.1.0' //api 'androidx.vectordrawable:vectordrawable-animated:1.1.0'

View File

@@ -3,4 +3,9 @@
<color name="colorPrimary">#009688</color> <color name="colorPrimary">#009688</color>
<color name="colorPrimaryDark">#00796B</color> <color name="colorPrimaryDark">#00796B</color>
<color name="colorAccent">#FF9800</color> <color name="colorAccent">#FF9800</color>
<color name="mainWindowBackgroundColor">#FFF5F5F5</color>
<color name="mainWindowTextColor">#FF000000</color>
<color name="toolbarBackgroundColor">#FF009688</color>
<color name="toolbarTextColor">#FFFFFFFF</color>
<color name="debugTextColor">#FF808080</color>
</resources> </resources>

View File

@@ -1,11 +1,34 @@
<resources> <resources>
<!-- Base application theme. -->
<style name="MyAppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <style name="MyAppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item> <item name="colorAccent">@color/colorAccent</item>
<item name="themeDebug">@style/MyDebugActivityTheme</item>
<item name="toolbarBackgroundColor">@color/toolbarBackgroundColor</item>
<item name="toolbarTextColor">@color/toolbarTextColor</item>
<item name="textViewBackgroundColor">?attr/mainWindowBackgroundColor</item>
<item name="textViewTextColor">?attr/mainWindowTextColor</item>
<item name="editTextBackgroundColor">?attr/mainWindowBackgroundColor</item>
<item name="editTextTextColor">?attr/mainWindowTextColor</item>
<item name="scrollViewBackgroundColor">?attr/mainWindowBackgroundColor</item>
<item name="activityBackgroundColor">?attr/mainWindowBackgroundColor</item>
<item name="activityTextColor">?attr/mainWindowTextColor</item>
<item name="mainWindowBackgroundColor">@color/mainWindowBackgroundColor</item>
<item name="mainWindowTextColor">@color/mainWindowTextColor</item>
<item name="mainWindowDarkBackgroundColor">@color/mainWindowBackgroundColor</item>
<item name="mainWindowDarkTextColor">@color/mainWindowTextColor</item>
</style>
<style name="MyDebugActivityTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:statusBarColor">@color/colorPrimaryDark</item>
<item name="colorTittle">?attr/mainWindowTextColor</item>
<item name="colorTittleBackgound">?attr/toolbarBackgroundColor</item>
<item name="colorText">?attr/debugTextColor</item>
<item name="colorTextBackgound">?attr/mainWindowBackgroundColor</item>
<item name="debugTextColor">@color/debugTextColor</item>
<item name="toolbarTextColor">@color/toolbarTextColor</item>
</style> </style>
</resources> </resources>