XML drawable在4.3和4.1.2上具有不同的行为

Sim*_*imo 7 android xml-drawable android-drawable

我有下面的drawable,

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
    <corners android:radius="3dp"/>
    <padding android:left="1dp" android:right="1dp" android:top="1dp" android:bottom="1dp"/>
     <stroke android:width="1dp" android:color="#e4e4e4"/>

</shape>
Run Code Online (Sandbox Code Playgroud)

"它应该"在背景上设置时绘制边框,实际上它(Android 4.3/goole nexus 7)确实如此,但不幸的是(Android 4.1.2 /三星galaxy tab 10")它只是用颜色填充所有背景

如果有人可以告诉我我做错了什么,或者有人有一个xml drawable for border,我会非常感激:=)

Sim*_*imo 19

这是具有相同drawable的解决方案

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
    <solid android:color="@android:color/transparent" />
    <corners android:radius="3dp"/>
    <stroke android:width="1dip" android:color="#e2e2e2"/>
</shape>
Run Code Online (Sandbox Code Playgroud)

我只需要指定纯色:

 <solid android:color="@android:color/transparent" />
Run Code Online (Sandbox Code Playgroud)