首页 > android应用开发,圆角背景,shape中设置topLeftRadius后四个角都变化

android应用开发,圆角背景,shape中设置topLeftRadius后四个角都变化

RT,使用shape设定形状时,设置corners的topLeftRadius后,界面上显示控件四个角都有变化,而且设置bottomRightRadius、bottomLeftRadius、bottomRightRadius这三项没有用,圆角半径仍然为topLeftRadius的值。

这是shape中标签属性的代码,然后修改VIEW的background为这个shape后显示四个角的半径都为20dp,而不是只有上面两个角为20dp。

<corners  
    android:topLeftRadius="20dp"
    android:bottomLeftRadius="5dp"
    android:topRightRadius="20dp"
    android:bottomRightRadius="5dp"/>

<solid 
    android:color="#55FFFFFF" />

<stroke
    android:width="1dp"
    android:color="#CCCCCC" />

Eclipse预览是这样,运行到手机就好了。


我用View和ImageView,
分别在Layout文件中设置background和src或background
在代码中设置setBackgroundResource()
均能正常显示,没有你描述的这种现象。
建议你新建一个testDemo,单独测试View或ImageView试试

【热门文章】
【热门文章】