android中圆角的bug

android的兼容性真是一个不可忽略的问题,今天测试时发现使用xml定义Shape drawable在android 2.1上存在bug



    

    

把上面的xml定义作为Button的background时,在android 2.2和android 2.3都能正常显示圆角;但在android 2.1的真机和模拟器上均无法显示圆角

研读了一下android doc,发现这么一句话

Note: Every corner must (initially) be provided a corner radius greater than 1, or else no corners are rounded. If you want specific corners to not be rounded, a work-around is to use android:radius to set a default corner radius greater than 1, but then override each and every corner with the values you really want, providing zero ("0dp") where you don't want rounded corners.
于是改为


    

    

一切正常

google了一下,发现http://code.google.com/p/android/issues/detail?id=939,原来多年以前就有人提过这个bug了,高人给出了建议

使用很小的radius来到达一个近似与“方角”的效果,恩,很好的work around






你可能感兴趣的:(android,java,android,encoding,button,xml,google,each)