圆角矩形 常用作一些组件的背景
构造函数:
RoundRectShape(float[] outerRadii, RectF inset, float[] innerRadii)
Specifies an outer (round)rect and an optional inner (round)rect.// 指定一个外部(圆角)矩形 和 一个 可选的 内部(圆角)矩形。
Parameters:
outerRadii
An array of 8 radius values, for the outer roundrect. The first two floats are for the top-left corner (remaining pairs correspond clockwise). For no rounded corners on the outer rectangle, pass null.
//一个包含8个弧度值,指定外部圆角矩形的 4个角部的弧度及 :new float[] {l, l, t, t, r, r, b, b};
// 前2个 左上角, 3 4 , 右上角, 56, 右下, 78 ,左下,如果没弧度的话,传入null即可。
inset
A RectF that specifies the distance from the inner rect to each side of the outer rect. For no inner, pass null.
//指定外部矩形4条边 与内部矩形的4条边的个距离,也用RectF的方式指定。
innerRadii
An array of 8 radius values, for the inner roundrect. The first two floats are for the top-left corner (remaining pairs correspond clockwise). For no rounded corners onthe inner rectangle, pass null. If inset parameter is null, this parameter is ignored.
//同第一个参数。
例子如下:
效果图: