android: shape corners do not work when setting individual corners

后端 未结 5 1563
庸人自扰
庸人自扰 2021-01-02 01:21

I need to have a background which has rounded bottom left/right coners(but not top left/right ones), below is my xml file:



        
5条回答
  •  旧时难觅i
    2021-01-02 01:41

    It seems to be a known issue. Every corner must be >1 or else no corners will be rounded. According to the Android documentation it can be done but it's kind of hacky:

    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.

    See here: http://developer.android.com/guide/topics/resources/drawable-resource.html#corners-element

提交回复
热议问题