开发者

Android rounding corners in layout with different radius values

I'm trying to make an intention which has a transparent background, and a solid foreground with some basic info and rounded corners. Currently I can use a shape with a rounded corners if all the corners are the same radius using

<cor开发者_高级运维ners android:radius="20dp" />

But if I try to have, say, just the bottom rounded like this:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid
android:color="#cccccc" />
<corners android:radius="20dp" android:topLeftRadius="0dp"
    android:topRightRadius="0dp" 
    android:bottomLeftRadius="20dp"
    android:bottomRightRadius="20dp" />
</shape>

or anything similar, then I get an error in my layout which says

layout.xml: java.lang.UnsupportedOperationException

any suggestions?


Try dropping the android:radius=20dp and just have the individual radii. Also, you should probably switch to dip instead of dp.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜