形状可绘制在三星设备默认的黑色背景 [英] Shape Drawables on Samsung devices default to black background

查看:152
本文介绍了形状可绘制在三星设备默认的黑色背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我用的是三星注2设备,由于某种原因,当我创建这个可绘制的发展

So I'm developing using a Samsung Note 2 device and for some reason when I create this drawable

<shape xmlns:android="http://schemas.android.com/apk/res/android" >

<corners android:radius="5dp" />

<stroke
    android:width="1dp"
    android:color="@color/grey_light" />
</shape>

和它应用为背景,以一个LinearLayout中,它使背景黑色,

and apply it as a background to a LinearLayout, it makes the background black,

如果我删除的LinearLayout的背景属性,它完全保持透明,只有当我申请一个绘制它它变黑。

If I remove the background attribute of the LinearLayout altogether it stays transparent, only when I apply a drawable to it does it turn black.

但如果我添加

<solid android:color="@android:color/transparent" />

到XML绘制的顶部,它消除了黑色。

to the top of the drawable XML, it removes the black.

现在我知道的设备可以有自己默认的主题,但是这似乎是怪异的行为,有没有什么办法,我可以摆脱它(/默认后台透明的),所以我没有把它添加更多我可绘制?

Now I know devices can have their own default themes but this seems like weird behaviour, is there any way I could get rid of it (/default the background to transparent) so that I don't have to add this to more of my drawables?

请注意:它工作正常的Nexus 7,HTC之一,其仅在三星的设备,出现这种情况

Note: it works fine on Nexus 7, HTC One, its only on Samsung devices that this happens.

推荐答案

我几个月前碰到了这一点。尽我所知,三星改变的东西在Android的code所以现在你必须定义固体标记。就在坚实的标签添加到您的可绘制。

I ran into this a couple of months ago. To the best of my knowledge, Samsung changed something in Android's code so now you have to define the solid tag. Just add the solid tag to your drawables.

这篇关于形状可绘制在三星设备默认的黑色背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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