gpt4 book ai didi

java - 使用 shape drawable 作为我的背景 xml

转载 作者:IT老高 更新时间:2023-10-28 20:32:18 32 4
gpt4 key购买 nike

如果有人可以帮助我使用 shape drawable 作为我的 View 的背景 xml,我真的很感激。

这是我尝试过的:但我从来没有得到颜色。无论我放置什么颜色属性,Android 总是给我白色背景上的黑色文本。

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke android:width="1dip" android:color="#FBBB" />
<solid android:color="#6000"/>
</shape>

试过了,不行

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"
android:color="#6000>

</shape>

试过了,不行

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"
android:background="#6000>
</shape>

我用谷歌搜索这是我发现尝试的有限结果。

最佳答案

颜色设置错误,必须指定4字节颜色,​​例如:#ffff8080

<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#f0600000"/>
<stroke android:width="3dp" android:color="#ffff8080"/>
<corners android:radius="3dp" />
<padding android:left="10dp" android:top="10dp"
android:right="10dp" android:bottom="10dp" />
</shape>

关于java - 使用 shape drawable 作为我的背景 xml,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1276346/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com