Skip to content

Custom Position

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

Customize the number and positions of pieces and boom-buttons.

Custom Position

Sometimes we may want 12 boom-buttons or more, and perhaps we need to put the 12 pieces and boom-buttons to the positions that are not supported in BMB. Then you can customize number and positions of pieces and boom-buttons.

app:bmb_buttonEnum="textInsideCircle"
app:bmb_piecePlaceEnum="piecePlace_custom"
app:bmb_buttonPlaceEnum="buttonPlace_custom"

Then you need to tell BMB the positions of pieces:

bmb.getCustomPiecePlacePositions().add(new PointF(Util.dp2px(+6), Util.dp2px(-6)));
bmb.getCustomPiecePlacePositions().add(new PointF(0, 0));
bmb.getCustomPiecePlacePositions().add(new PointF(Util.dp2px(-6), Util.dp2px(+6)));

And the positions of boom-buttons:

bmb.getCustomButtonPlacePositions().add(new PointF(Util.dp2px(-80), Util.dp2px(-80)));
bmb.getCustomButtonPlacePositions().add(new PointF(0, 0));
bmb.getCustomButtonPlacePositions().add(new PointF(Util.dp2px(+80), Util.dp2px(+80)));

Notice that the coordinate system is the same as android-platform but the center position is (0, 0). And you don't need to customize both pieces and boom-buttons, check demo for more details.