【发布时间】:2015-10-23 11:33:00
【问题描述】:
我正在使用一个形状元素作为视图的背景,就像SO question 一样。我正在使用 Android Studio,它告诉我...
Element shape doesn't have required attribute android:layout_height
Element shape doesn't have required attribute 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>
所以基本上我的问题是:如果形状在技术上不需要这些属性,为什么会出现这个错误?如何告诉 android 停止将其标记为错误或如何避免?
谢谢。
已解决:原因是它不在 drawable 文件夹中。
编辑:是的,我知道笔画部分不正确。
【问题讨论】: