【发布时间】:2020-01-22 00:51:16
【问题描述】:
这是我的布局
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/c8"
android:orientation="vertical"
android:gravity="center_horizontal"
tools:context="com.leo.accelerate.activity.SplashActivity">
<ImageView
android:layout_marginTop="190dp"
android:layout_width="146dp"
android:layout_height="146dp"
android:src="@mipmap/icon_splash"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="36dp"
android:src="@mipmap/boost_shanping_name"
/>
</LinearLayout>
我得到了错误:
Caused by: android.content.res.Resources$NotFoundException: Resource "com.leo.accelerate:style/RtlOverlay.DialogWindowTitle.AppCompat" (7f0b0028) is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f0b0028 a=-1 r=0x7f0b0028}
根据地址值0x7f0b0028找到问题颜色
find . -type f | xargs grep "0x7f0b0028"
result:
./app-default-release/res/values/public.xml: <public type="color" name="c8" id="0x7f0b0028" />
./app-default-release/smali/com/leo/accelerate/R$color.smali:.field public static final c8:I = 0x7f0b0028
问题代码是名为c8的color值,用于布局中的背景属性
当我用drawable替换他时,问题就不存在了。
我该如何解决这个问题?
【问题讨论】:
-
如果还提供颜色资源文件代码就好了。
-
请告诉我们哪个答案对您有帮助,以及它是否解决了您的问题。
标签: android layout colors background