@NonNull
private ShapeDrawable getShapeDrawable(int topLeftAndRightRadius, int bottomLeftAndRightRadius, int bgColor) {
float outRectr[] = new float[]{
topLeftAndRightRadius, topLeftAndRightRadius,
topLeftAndRightRadius, topLeftAndRightRadius,
bottomLeftAndRightRadius, bottomLeftAndRightRadius,
bottomLeftAndRightRadius, bottomLeftAndRightRadius};
/**
* 注意StateListDrawable的构造方法我们这里使用的
* 是第一参数它是一个float的数组保存的是圆角的半径,它是按照top-left顺时针保存的八个值
*/
//创建圆弧形状
RoundRectShape rectShape = new RoundRectShape(outRectr, null, null);
//创建drawable
ShapeDrawable pressedDrawable = new ShapeDrawable(rectShape);
//设置背景的颜色
pressedDrawable.getPaint().setColor(bgColor);
return pressedDrawable;
}
MiddleLinesDialog.java 文件源码
java
阅读 42
收藏 0
点赞 0
评论 0
项目:MiddleLinesDialogUtils2.0
作者:
评论列表
文章目录