我正在使用一个shape元素作为视图的背景,就像这个问题一样.我正在使用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>
Run Code Online (Sandbox Code Playgroud)
基本上我的问题是:如果形状在技术上不需要这些属性,为什么会出现此错误?如何告诉android停止将其标记为错误或如何避免它?
谢谢.
已解决:原因是因为它不在drawable
文件夹中.
编辑:是的我知道中风部分是不正确的.
归档时间: |
|
查看次数: |
7483 次 |
最近记录: |