Android 无法在笔划对象中使用除白色或黑色以外的颜色
我正在为布局添加边界,但它不允许我定义除白色或黑色以外的颜色。奇怪的这是资源文件夹中boundary.xml的代码片段Android 无法在笔划对象中使用除白色或黑色以外的颜色,android,Android,我正在为布局添加边界,但它不允许我定义除白色或黑色以外的颜色。奇怪的这是资源文件夹中boundary.xml的代码片段 <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <stroke android:width="2dip" andr
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<stroke
android:width="2dip"
android:color="@android:color/white" />
</shape>
您可以在colors.xml中定义自己的颜色,然后作为
@color/mycolor
您还可以直接为android:color属性使用颜色代码,如#F00、#4F00(包含alpha通道)、#FF0000或#44FF0000(同样,具有alpha通道)尝试使用十六进制颜色值
android:color="#FF00FF00"
使用自定义颜色,首先以值的形式存储在colors.xml文件中,然后获取这些值以供使用。。 或者像这样
android:color="#FF0000"