I am now working on a drawing app, and users can select their customerized colors. Then the customerized color button would then be showing the chosen color. However, it become squared-corner once it was set to be the customerized color.
My coding is as follows:
How to set the customBtn such that it is round-corner and filled with customerized color (best to be programmatically as the customerized color will be changed upon user's choice)
actually what are those 10 for the new float[] array represent?
Many thanks!!
customColorCode = Color.argb(alphaSeekBar.getProgress(), redSeekBar.getProgress(),
greenSeekBar.getProgress(), blueSeekBar.getProgress());
RoundRectShape rs = new RoundRectShape(new float[] { 10, 10, 10, 10, 10, 10, 10, 10}, null, null);
ShapeDrawable sd = new ShapeDrawable(rs);
customBtn.setBackgroundDrawable(sd);
customBtn.setBackgroundColor(customColorCode);
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. inset A RectF that specifies the distance from the inner rect to each side of the outer rect. For no inner, pass null. 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 on the inner rectangle, pass null. If inset parameter is null, this parameter is ignored.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With