色值绘制资源问题 [英] color value drawable resource issue

查看:1084
本文介绍了色值绘制资源问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个形象,是1900 * 1200称为绘制-sw600dp文件夹中的ID喜欢有一个承上启下7中使用当我尝试运行应用程序的主要活动的屏幕是白色的,我得到以下错误

I have an image that is 1900*1200 in a folder called drawable-sw600dp that id like to have used on a nexus 7. When I try to run the app the main activity the screen is white and I get the following error:

java.lang.NumberFormatException: Color value '@drawable-sw600dp/background5' must start with #
at com.android.layoutlib.bridge.impl.ResourceHelper.getColor(ResourceHelper.java:71)
at com.android.layoutlib.bridge.impl.ResourceHelper.getDrawable(ResourceHelper.java:248)
at android.content.res.BridgeTypedArray.getDrawable(BridgeTypedArray.java:782)

难道该图像是太大而不能使用?或者有什么可能会导致发生这个错误?

Could it be that the image is too large to use? Or what could cause this error to happen?

这是我activity_main.xml中当背景设置:

This is in my activity_main.xml where the background is set:

xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background5"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:id="@+id/MainLayout"
tools:context=".MainActivity">

在我的其他文件夹绘制,华电国际,-mdpi是没有问题的。不过,我所做的.JPG图像分辨率更高,现在它创建了一个错误,这就是为什么我怀疑高分辨率导致了问题。

In my other folders drawable-hdpi,-mdpi there is no problem. However I made the .jpg image a higher resolution and now it creates this error, thats why I suspect the high resolution is causing the issue.

推荐答案

删除 - 中的文件名。

Remove the '-' in the file name.

注: - 是不是一个有效的基于文件的资源名称的字符:基于文件的资源名称必须只包含小写a-Z,0-9或下划线

NOTE: '-' is not a valid file-based resource name character: File-based resource names must contain only lowercase a-z, 0-9, or underscore

这篇关于色值绘制资源问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆