Closed wizos closed 5 years ago
试一下这种写法
Drawable drawable22 = new DrawableCreator.Builder()
.setRipple(true,getResources().getColor(R.color.colorPrimary))
.setPressedStrokeColor(getColor(R.color.colorPrimary), getColor(R.color.colorPrimaryDark))
.setSolidColor(getColor(R.color.colorPrimaryDark))
.setCornersRadius(30)
.build();
使用圆角的时候需要指定stoke填充颜色,而非press状态的颜色
代码如下,只有圆角没有效果
Drawable drawable = new DrawableCreator.Builder() .setUnPressedDrawable( getDrawable(R.color.bluePrimary) ) .setRipple(true,getResources().getColor(R.color.primary)) .setCornersRadius(ScreenUtil.dp2px(30)) .build(); imageView.setBackground(drawable);