Buttonstyle - 尺寸类型不允许
Buttonstyle - Dimension types not allowed
我设计了一个按钮,如下所示,但是收到了一些错误信息。
android:background="@drawable/buttonshape"
android:shadowColor="#A8A8A8"
android:shadowDx="0dp"
android:shadowDy="0dp"
android:shadowRadius="5dp"
Dimension types not allowed (at 'shadowDy' with value '0dp').
Dimension types not allowed (at 'shadowRadius' with value '5dp').
Dimension types not allowed (at 'shadowDx' with value '0dp').
buttonshape.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<corners
android:radius="14dp"
/>
<gradient
android:angle="45"
android:centerX="35%"
android:centerColor="#198CFF"
android:startColor="#449DEF"
android:endColor="#2F6699"
android:type="linear"
/>
<padding
android:left="0dp"
android:top="0dp"
android:right="0dp"
android:bottom="0dp"
/>
<stroke
android:width="1dp"
android:color="#878787"
/>
</shape>
只是不要使用单位,例如:
android:shadowDx="2"
android:shadowDy="2"
android:shadowRadius="5"
android:shadowColor="#A8A8A8"
我设计了一个按钮,如下所示,但是收到了一些错误信息。
android:background="@drawable/buttonshape"
android:shadowColor="#A8A8A8"
android:shadowDx="0dp"
android:shadowDy="0dp"
android:shadowRadius="5dp"
Dimension types not allowed (at 'shadowDy' with value '0dp'). Dimension types not allowed (at 'shadowRadius' with value '5dp'). Dimension types not allowed (at 'shadowDx' with value '0dp').
buttonshape.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<corners
android:radius="14dp"
/>
<gradient
android:angle="45"
android:centerX="35%"
android:centerColor="#198CFF"
android:startColor="#449DEF"
android:endColor="#2F6699"
android:type="linear"
/>
<padding
android:left="0dp"
android:top="0dp"
android:right="0dp"
android:bottom="0dp"
/>
<stroke
android:width="1dp"
android:color="#878787"
/>
</shape>
只是不要使用单位,例如:
android:shadowDx="2"
android:shadowDy="2"
android:shadowRadius="5"
android:shadowColor="#A8A8A8"