机器人:造型角不设置单独的弯道时,工作 [英] android: shape corners do not work when setting individual corners

查看:110
本文介绍了机器人:造型角不设置单独的弯道时,工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要有一个背景,有圆形的底部左/右coners(但不是左上/右的),下面是我的xml文件:

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

<?xml version="1.0" encoding="utf-8"?>
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android">
<item>
    <shape android:shape="rectangle" android:padding="1dp">
        <solid android:color="#FFbdbebd"/>
        <corners
            android:bottomLeftRadius="12dip"
            android:bottomRightRadius="12dip"
            android:topLeftRadius="0dip"
            android:topRightRadius="0dip"/>
    </shape>
</item>
</layer-list>

但结果却是一个普通的矩形,没有任何一个角落圆润,如果我只用:

But the result is a plain rectangle without any corner rounded, if I only use:

android:radius="12dip"

那么所有的边角圆润,我搜索,发现与此相关的一个错误:

then all corners are rounded, I searched and found a bug related to this:

<一个href="http://$c$c.google.com/p/android/issues/detail?id=9161">http://$c$c.google.com/p/android/issues/detail?id=9161

但错误状态:

左/右切换,由于Android:bottomRightRadius =2DP横空出世,以指定左底部圆角

Left/right is switched, because android:bottomRightRadius="2dp" turned out to specify left-bottom rounded corner.

这可能不是relavent我的问题,我也试过用:

which may not be relavent to my issue, I also tried to use:

android:radius="12dip"

之后

android:topLeftRadius="0dip"
android:topRightRadius="0dip"

没有成功。

谁能帮助?谢谢!

推荐答案

我觉得有可能是一个错误,如果你设置各个角落,如果其中任何一个为0时,所有的人都变成0,所以最后我设置他们两个1dip和其他两到任何我所需要的,他们都不是0,因此错误不会影响它,结果看起来不错。

I found there may be a bug that if you set individual corners, and if any of them is 0, all of them become 0, so in the end I set two of them to 1dip and other two to whatever I need, as none of them is 0, so the bug does not affect it and the result looks good.

这篇关于机器人:造型角不设置单独的弯道时,工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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