Skip to content

Button Place Alignments

Weiping Huang edited this page Mar 28, 2017 · 3 revisions

Place all the buttons to anywhere on screen.

Button Place Alignments

In version 2.0.0 or above, the place-alignment of boom-buttons on the screen(or its parent-view) is able to customized. This is helpful when BMB is used in pad(picture above). You can set this attribute by:

bmb.setButtonPlaceAlignmentEnum(ButtonPlaceAlignmentEnum.BL);

Or in .xml:

app:bmb_buttonPlaceAlignmentEnum="buttonPlaceAlignment_bl"

The meanings of each button-place-alignment-enum:

  1. ButtonPlaceAlignmentEnum.Center(in .java) or buttonPlaceAlignment_center(in .xml)
    Center.
  2. ButtonPlaceAlignmentEnum.Top(in .java) or buttonPlaceAlignment_top(in .xml)
    Top.
  3. ButtonPlaceAlignmentEnum.Bottom(in .java) or buttonPlaceAlignment_bottom(in .xml)
    Bottom.
  4. ButtonPlaceAlignmentEnum.Left(in .java) or buttonPlaceAlignment_left(in .xml)
    Left.
  5. ButtonPlaceAlignmentEnum.Right(in .java) or buttonPlaceAlignment_right(in .xml)
    Right.
  6. ButtonPlaceAlignmentEnum.TL(in .java) or buttonPlaceAlignment_tl(in .xml)
    Top-Left.
  7. ButtonPlaceAlignmentEnum.TR(in .java) or buttonPlaceAlignment_tr(in .xml)
    Top-Right.
  8. ButtonPlaceAlignmentEnum.BL(in .java) or buttonPlaceAlignment_bl(in .xml)
    Bottom-Left.
  9. ButtonPlaceAlignmentEnum.BR(in .java) or buttonPlaceAlignment_br(in .xml)
    Bottom-Right.

More Accurate

Boom-buttons is able to customize the margin between surroundings. For example:

bmb.setButtonTopMargin(10);
bmb.setButtonBottomMargin(10);
bmb.setButtonLeftMargin(10);
bmb.setButtonRightMargin(10);

Or in .xml:

app:bmb_buttonTopMargin="1dp"
app:bmb_buttonBottomMargin="1dp"
app:bmb_buttonLeftMargin="1dp"
app:bmb_buttonRightMargin="1dp"