XML drawable在4.3和4.1.2上具有不同的行为 [英] XML drawable having different behavior on 4.3 and 4.1.2

查看:112
本文介绍了XML drawable在4.3和4.1.2上具有不同的行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下绘画对象

<?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>

应该"会在背景上设置边框,实际上是在(Android 4.3/goole nexus 7)上绘制,但是不幸的是,在(Android 4.1.2/Samsung Galaxy Tab 10)上,边框会填满所有背景颜色

"It supposed" to draw a border when set on background, actually on (Android 4.3 /goole nexus 7) it does , but unfortunately on (Android 4.1.2/ Samsung galaxy tab 10") it just fill all the background with the color

如果有人可以告诉我我做错了什么,或者有人可以为边框绘制xml, 我将非常感激:=)

If someone can tell me what I'm doing wrong, or if someone has an xml drawable for border, I will be very thankful :=)

推荐答案

这是具有相同可绘制对象的解决方案

here is the solution with the same 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>

我只需要指定纯色:

 <solid android:color="@android:color/transparent" />

这篇关于XML drawable在4.3和4.1.2上具有不同的行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆