Skip to content

Attributes for BMB or Pieces on BMB

Weiping Huang edited this page May 26, 2017 · 7 revisions

How to change the size or margins of dots on BMB?

Attributes for BMB

We always talk about the attributes for boom-buttons of BMB, how about BMB itself?

For BMB Itself

For shadow:
bmb.setShadowEffect(true);
bmb.setShadowColor(Color.parseColor("#55000000"));
bmb.setShadowOffsetX(20);
bmb.setShadowOffsetY(20);
bmb.setShadowRadius(10);

Or in .xml:

app:bmb_shadowEffect="true"
app:bmb_shadowColor="#55000000"
app:bmb_shadowOffsetX="5dp"
app:bmb_shadowOffsetY="5dp"
app:bmb_shadowRadius="10dp"
For button:
bmb.setButtonRadius(Util.dp2px(40));
bmb.setRippleEffect(false);
bmb.setNormalColor(Color.BLACK);
bmb.setHighlightedColor(Color.BLUE);
bmb.setUnableColor(Color.WHITE);

Or in .xml:

app:bmb_buttonRadius="40dp"
app:bmb_rippleEffect="true"
app:bmb_normalColor="@android:color/holo_blue_light"
app:bmb_highlightedColor="@android:color/holo_blue_dark"
app:bmb_unableColor="@android:color/white"
For draggable-BMB:
bmb.setDraggable(true);
bmb.setEdgeInsetsInParentView(new Rect(10, 10, 10, 10));

Or in .xml:

app:bmb_draggable="true"

The effect of draggable-BMB looks like below:

For Pieces on BMB

For pieces lay on BMB:

bmb.setDotRadius(10);
bmb.setHamWidth(80);
bmb.setHamHeight(20);
bmb.setPieceCornerRadius(4);
bmb.setPieceHorizontalMargin(10);
bmb.setPieceVerticalMargin(10);
bmb.setPieceInclinedMargin(20);

Or in .xml:

app:bmb_dotRadius="5dp"
app:bmb_hamWidth="40dp"
app:bmb_hamHeight="5dp"
app:bmb_pieceCornerRadius="2dp"
app:bmb_pieceHorizontalMargin="5dp"
app:bmb_pieceVerticalMargin="5dp"
app:bmb_pieceInclinedMargin="5dp"

After setting the corner radius of the pieces:

This attribute is useful when you want square buttons but not round:

For more information about square buttons, check:
Square Simple Circle Button
Square Text Inside Circle Button
Square Text Outside Button

For Boom-Buttons on BMB

bmb.setButtonHorizontalMargin(50);
bmb.setButtonVerticalMargin(40);
bmb.setButtonInclinedMargin(100);

Or in .xml:

app:bmb_buttonHorizontalMargin="20dp"
app:bmb_buttonVerticalMargin="20dp"
app:bmb_buttonInclinedMargin="30dp"

For Background Color When Booming

bmb.setDimColor(Color.parseColor("#55000000"))

Or in .xml:

app:bmb_dimColor="#55000000"
Clone this wiki locally