JavaNoober / BackgroundLibrary

A framework for directly generating shape through Tags, no need to write shape.xml again(通过标签直接生成shape,无需再写shape.xml)
Apache License 2.0
3.86k stars 469 forks source link

代码设置圆角没有效果 #70

Closed wizos closed 5 years ago

wizos commented 5 years ago

代码如下,只有圆角没有效果

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);

JavaNoober commented 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();

JavaNoober commented 5 years ago

使用圆角的时候需要指定stoke填充颜色,而非press状态的颜色