小编Jak*_*kob的帖子

Android:将可绘制对象添加到 styles.xml 时出现 Resources$NotFoundException

我有这个splash_screen.xml

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:drawable="@color/colorPrimary"/>

    <item
        android:gravity="center"
        android:src="@mipmap/ic_launcher"/>
</layer-list>
Run Code Online (Sandbox Code Playgroud)

然后我想将其添加为<item>to styles.xml

<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
    <item name="android:windowBackground">@drawable/splash_screen</item>
</style>
Run Code Online (Sandbox Code Playgroud)

但这会抛出:

Caused by: android.content.res.Resources$NotFoundException: File res/drawable/splash_screen.xml from drawable resource ID #0x7f070099
Run Code Online (Sandbox Code Playgroud)

当我尝试时:

<item name="android:windowBackground">@color/colorPrimary</item>
Run Code Online (Sandbox Code Playgroud)

我的代码工作正常并以 colorPrimary 显示屏幕。

我该如何修复它?

我尝试重建、清理、重新启动 Android Studio 以及 SO 上的每一篇文章。没有任何帮助。

编辑

splash_screen.xml肯定是在drawable文件夹中。

在此输入图像描述

Android Studio 正在建议该文件。

我的绘图文件夹:

在此输入图像描述

android exception file splash-screen filenotfoundexception

3
推荐指数
1
解决办法
808
查看次数

倒置PHP数组值?

我有这个数组回声:(2 5 7 13 19 22 23 37 41 41 64 74 85 96 139);
但是我需要这个回声:(139 96 85 74 64 41 41 37 23 22 19 13 7 5 2);
我找不到,如何颠倒回声值?

$num= array(7,13,85,64,2,41,22,96,139,37,41,19,74,23,5);
$max= max($num);
$a= count($num);
sort($num);

for ($x=0; $x < $a; $x++) {
        echo $num[$x]. " ";
}
Run Code Online (Sandbox Code Playgroud)

输出: 2 5 7 13 19 22 23 37 41 41 64 74 85 96 139

php arrays

1
推荐指数
1
解决办法
103
查看次数