android View使用shape作为背景不能指定单边圆角的xml
来源:互联网 发布:linux系统安装教程图解 编辑:程序博客网 时间:2024/05/18 02:51
在使用shape作为背景的时候,代码如下:
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" ><corners android:topLeftRadius="30dp" android:bottomLeftRadius="30dp" android:topRightRadius="0dp" android:bottomRightRadius="0dp"/> <solid android:color="#ff0000"/></shape>在android3.0以上显示正常如下:
但是在android3.0以下,比如android2.3.3结果如下:
这显然不符合我们的要去,我想了很多办法都没能解决,只有通过图片背景来实现,但我在stackoverflow看到一方案计较好,记录一下:
代码如下:
<?xml version="1.0" encoding="utf-8"?><layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="rectangle"> <solid android:color="#FF0000" /> <corners android:radius="30dp"/> </shape> </item> <item android:left="30dp" > <shape android:shape="rectangle"> <solid android:color="#FF0000" /> </shape> </item></layer-list>现在效果都一样了,android2.3.3效果如下:
通过两个层,变相的解决了这个问题,希望对大家有帮助!!!!
最后附上stackoverflow的地址:http://stackoverflow.com/questions/8399517/why-i-am-not-able-to-create-the-round-border-for-specific-corner
5 0
- android View使用shape作为背景不能指定单边圆角的xml
- xml实现shape,作为背景
- android 背景shape的使用
- 【android】 使用一个shape.xml文件,使用代码设置不同圆角背景颜色
- Android下基于XML的Graphics shape的高级UI设计,定义圆角背景等
- android中view使用背景shape显示不出圆角
- 自定义背景文件,android:shape的使用!
- 自定义背景文件,android:shape的使用!
- 自定义背景文件,android:shape的使用!
- Android中Shape、selector在xml中的使用、切换按钮的背景图案
- android 使用shape做背景
- Android 使用Shape自定义背景
- android自定义背景shape使用
- 使用一个shape.xml文件,使用代码设置不同圆角背景颜色
- Android之XML的shape使用
- 自定义背景shape的使用
- Android 用 xml View shape画线
- Android设置单边圆角边框
- 程序开发的好习惯
- 第一次只出现一次的字符
- C++学习笔记24 函数模板
- PB9和PB11.5字符处理实例
- 工厂方法重构策略
- android View使用shape作为背景不能指定单边圆角的xml
- ros.usb_cam驱动的安装
- poj 1036 Gangsters(DP)
- linux安装图形界面
- Source insight 介绍
- 生成多个AWR报告
- 关于使用while(!filePCloud.eof())判断文件结尾进行数据输入装换时注意事项
- Linux编程基础:C标准库IO缓冲区与内核缓冲区的区别
- Lua,ruby和Python的比较