我正在使用一个形状元素作为视图的背景,参考了这个SO问题。我使用的是Android Studio,它告诉我...
基本上我的问题是:如果形状技术上不需要这些属性,为什么会出现此错误?我怎样才能告诉安卓停止将其标记为错误或者如何避免它?
谢谢。
已解决:原因是因为它不在
编辑:是的,我知道描边部分是不正确的。
元素形状缺少必需属性android:layout_height
元素形状缺少必需属性android:layout_width
代码如下:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/darkBrown"/>
<stroke android:layout_width="match_parent" android:layout_height="match_parent"/>
<corners android:radius="10dip"/>
<padding android:left="0dip" android:right="0dip" android:top="0dip" android:bottom="0dip"/>
</shape>
基本上我的问题是:如果形状技术上不需要这些属性,为什么会出现此错误?我怎样才能告诉安卓停止将其标记为错误或者如何避免它?
谢谢。
已解决:原因是因为它不在
drawable
文件夹中。编辑:是的,我知道描边部分是不正确的。