圆润的边角与边框颜色 [英] round corners with border color
本文介绍了圆润的边角与边框颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用下面的code以获得圆润的边角,以及彩色轮廓:
I am using the following code to get rounded corners as well as a colored outline:
<?xml version="1.0" encoding="UTF-8"?>
<gradient
android:startColor="@color/white"
android:endColor="@color/white" />
<corners
android:bottomRightRadius="2dp"
android:bottomLeftRadius="2dp"
android:topLeftRadius="2dp"
android:topRightRadius="2dp"/>
<stroke
android:width="5dip"
android:color="@color/black" />
图片显示的内容我得到现在。由于中风
,系统圆角只趴在布局和黑色轮廓的内缘的外边缘与尖锐边缘的矩形。我如何转换锋利边缘圆角?
The image displays what I'm getting right now. Due to the stroke
, the rounded corners only lie on the outer edge of the layout and the inner edge of the black outline makes a rectangle with sharp edges. How can I convert the sharp edges to rounded corners?
推荐答案
使用了&LT;形状&GT;
标签来创建XML带有圆角的绘制。 (你可以做其他的东西的形状像标签定义颜色渐变也一样)。
Use the <shape>
tag to create a drawable in XML with rounded corners. (You can do other stuff with the shape tag like define a color gradient as well).
随着code可以帮助你:
Following code may help you:
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ffffffff"/>
<stroke android:width="3dp"
android:color="#ff000000"
/>
<padding android:left="1dp"
android:top="1dp"
android:right="1dp"
android:bottom="1dp"
/>
<corners android:bottomRightRadius="7dp"
android:bottomLeftRadius="7dp"
android:topLeftRadius="7dp"
android:topRightRadius="7dp"/>
</shape>
这篇关于圆润的边角与边框颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文