Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B BoomMenu
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 114
    • Issues 114
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 5
    • Merge requests 5
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • 黄伟平
  • BoomMenu
  • Wiki
  • Text Inside Circle Button

Text Inside Circle Button · Changes

Page history
Updated Text Inside Circle Button (markdown) authored Mar 28, 2017 by Weiping Huang's avatar Weiping Huang
Hide whitespace changes
Inline Side-by-side
Text-Inside-Circle-Button.md
View page @ 9a1c228b
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
Add text inside circle buttons with a text and image inside for each to BMB. Add text inside circle buttons with a text and image inside for each to BMB.
###Create BMB ### Create BMB
Add BMB in .xml file. Add BMB in .xml file.
...@@ -18,7 +18,7 @@ Add BMB in .xml file. ...@@ -18,7 +18,7 @@ Add BMB in .xml file.
``` ```
You can set button-enum, piece-place-enum and button-place-enum in .xml file with attributes or in .java file with setters. For more information and pictures about [piece-place-enum](https://github.com/Nightonke/BoomMenu/wiki/Text-Inside-Circle-Button#piece-place-enum-for-text-inside-circle-button) and [button-place-enum](https://github.com/Nightonke/BoomMenu/wiki/Text-Inside-Circle-Button#button-place-enum-for-text-inside-circle-button), check the tables below. You can set button-enum, piece-place-enum and button-place-enum in .xml file with attributes or in .java file with setters. For more information and pictures about [piece-place-enum](https://github.com/Nightonke/BoomMenu/wiki/Text-Inside-Circle-Button#piece-place-enum-for-text-inside-circle-button) and [button-place-enum](https://github.com/Nightonke/BoomMenu/wiki/Text-Inside-Circle-Button#button-place-enum-for-text-inside-circle-button), check the tables below.
###Add Builders ### Add Builders
The builder of text inside circle button has lots of methods to customize the boom-buttons. **Needn't to set every attributes for boom-buttons, just customize what you want.** For example: The builder of text inside circle button has lots of methods to customize the boom-buttons. **Needn't to set every attributes for boom-buttons, just customize what you want.** For example:
``` ```
for (int i = 0; i < bmb.getPiecePlaceEnum().pieceNumber(); i++) { for (int i = 0; i < bmb.getPiecePlaceEnum().pieceNumber(); i++) {
...@@ -58,6 +58,9 @@ for (int i = 0; i < bmb.getPiecePlaceEnum().pieceNumber(); i++) { ...@@ -58,6 +58,9 @@ for (int i = 0; i < bmb.getPiecePlaceEnum().pieceNumber(); i++) {
// Set the radius of shadow of the boom-button. // Set the radius of shadow of the boom-button.
.shadowRadius(Util.dp2px(20)) .shadowRadius(Util.dp2px(20))
// Set the corner-radius of the shadow.
.shadowCornerRadius(Util.dp2px(20))
// Set the color of the shadow of boom-button. // Set the color of the shadow of boom-button.
.shadowColor(Color.parseColor("#ee000000")) .shadowColor(Color.parseColor("#ee000000"))
...@@ -176,17 +179,38 @@ for (int i = 0; i < bmb.getPiecePlaceEnum().pieceNumber(); i++) { ...@@ -176,17 +179,38 @@ for (int i = 0; i < bmb.getPiecePlaceEnum().pieceNumber(); i++) {
.unable(true) .unable(true)
// The radius of boom-button, in pixel. // The radius of boom-button, in pixel.
.buttonRadius(Util.dp2px(40)); .buttonRadius(Util.dp2px(40))
// Set the corner-radius of button.
.buttonCornerRadius(Util.dp2px(20))
// Whether the button is a circle shape.
.isRound(false);
bmb.addBuilder(builder); bmb.addBuilder(builder);
} }
``` ```
After adding builders to BMB, it is ready for a boom. After adding builders to BMB, it is ready for a boom.
### Square Button
From version 2.0.8, BMB supports square buttons base on the circle buttons. To make boom-button square, use the following methods for a builder([Example](https://github.com/Nightonke/BoomMenu/blob/master/app/src/main/java/com/nightonke/boommenusample/SquareAndPieceCornerRadiusActivity.java)):
```
return new TextInsideCircleButton.Builder()
.isRound(false)
.shadowCornerRadius(Util.dp2px(10))
.buttonCornerRadius(Util.dp2px(10))
.normalImageRes(getImageResource())
.normalTextRes(R.string.text_inside_circle_button_text_normal);
```
<img src="https://github.com/Nightonke/BoomMenu/blob/master/Pictures/pieceCornerRadius.png" width=300/>
<img src="https://github.com/Nightonke/BoomMenu/blob/master/Pictures/square.png" width=300/>
And to make the transformation natural, you may want to make the pieces square, too. Check the `setPieceCornerRadius` method and `app:bmb_pieceCornerRadius` attribute [here](https://github.com/Nightonke/BoomMenu/wiki/Attributes-for-BMB-or-Pieces-on-BMB#for-pieces-on-bmb) to achieve that effect.
### Piece Place Enum for Text Inside Circle Button ### Piece Place Enum for Text Inside Circle Button
All piece-place-enum and button-place-enum can be found in [demo](https://github.com/Nightonke/BoomMenu/blob/master/app/src/main/java/com/nightonke/boommenusample/TextInsideCircleButtonActivity.java). All piece-place-enum and button-place-enum can be found in [demo](https://github.com/Nightonke/BoomMenu/blob/master/app/src/main/java/com/nightonke/boommenusample/TextInsideCircleButtonActivity.java).
1. PiecePlaceEnum.DOT_1(in .java) or bmb_piecePlace_dot_1(in .xml) 1. PiecePlaceEnum.DOT_1(in .java) or bmb_piecePlace_dot_1(in .xml)
<img src="https://github.com/Nightonke/BoomMenu/blob/master/Pictures/piece-place-enum/piece-place-enum-dot-1.png" width="100"> <img src="https://github.com/Nightonke/BoomMenu/blob/master/Pictures/piece-place-enum/piece-place-enum-dot-1.png" width="100">
2. PiecePlaceEnum.DOT_2_M(in .java) or bmb_piecePlace_dot_2_M(in .xml) 2. PiecePlaceEnum.DOT_2_M(in .java) or bmb_piecePlace_dot_2_M(in .xml)
<img src="https://github.com/Nightonke/BoomMenu/blob/master/Pictures/piece-place-enum/piece-place-enum-dot-2-1.png" width="100"><img src="https://github.com/Nightonke/BoomMenu/blob/master/Pictures/piece-place-enum/piece-place-enum-dot-2-2.png" width="100"> <img src="https://github.com/Nightonke/BoomMenu/blob/master/Pictures/piece-place-enum/piece-place-enum-dot-2-1.png" width="100"><img src="https://github.com/Nightonke/BoomMenu/blob/master/Pictures/piece-place-enum/piece-place-enum-dot-2-2.png" width="100">
3. PiecePlaceEnum.DOT_3_M(in .java) or bmb_piecePlace_dot_3_M(in .xml) 3. PiecePlaceEnum.DOT_3_M(in .java) or bmb_piecePlace_dot_3_M(in .xml)
...@@ -209,7 +233,7 @@ src="https://github.com/Nightonke/BoomMenu/blob/master/Pictures/piece-place-enum ...@@ -209,7 +233,7 @@ src="https://github.com/Nightonke/BoomMenu/blob/master/Pictures/piece-place-enum
All piece-place-enum and button-place-enum can be found in [demo](https://github.com/Nightonke/BoomMenu/blob/master/app/src/main/java/com/nightonke/boommenusample/TextInsideCircleButtonActivity.java). All piece-place-enum and button-place-enum can be found in [demo](https://github.com/Nightonke/BoomMenu/blob/master/app/src/main/java/com/nightonke/boommenusample/TextInsideCircleButtonActivity.java).
1. ButtonPlaceEnum.SC_1(in .java) or bmb_buttonPlace_sc_1(in .xml) 1. ButtonPlaceEnum.SC_1(in .java) or bmb_buttonPlace_sc_1(in .xml)
<img src="https://github.com/Nightonke/BoomMenu/blob/master/Pictures/button-place-enum/text-inside-circle-button/button-place-enum-sc-1.png" width="100"> <img src="https://github.com/Nightonke/BoomMenu/blob/master/Pictures/button-place-enum/text-inside-circle-button/button-place-enum-sc-1.png" width="100">
2. ButtonPlaceEnum.SC_2_M(in .java) or bmb_buttonPlace_sc_2_M(in .xml) 2. ButtonPlaceEnum.SC_2_M(in .java) or bmb_buttonPlace_sc_2_M(in .xml)
<img src="https://github.com/Nightonke/BoomMenu/blob/master/Pictures/button-place-enum/text-inside-circle-button/button-place-enum-sc-2-1.png" width="100"><img src="https://github.com/Nightonke/BoomMenu/blob/master/Pictures/button-place-enum/text-inside-circle-button/button-place-enum-sc-2-2.png" width="100"> <img src="https://github.com/Nightonke/BoomMenu/blob/master/Pictures/button-place-enum/text-inside-circle-button/button-place-enum-sc-2-1.png" width="100"><img src="https://github.com/Nightonke/BoomMenu/blob/master/Pictures/button-place-enum/text-inside-circle-button/button-place-enum-sc-2-2.png" width="100">
3. ButtonPlaceEnum.SC_3_M(in .java) or bmb_buttonPlace_sc_3_M(in .xml) 3. ButtonPlaceEnum.SC_3_M(in .java) or bmb_buttonPlace_sc_3_M(in .xml)
......
Clone repository
Chapters
  1. Basic Usage
  2. Simple Circle Button
  3. Text Inside Circle Button
  4. Text Outside Circle Button
  5. Ham Button
  6. Share Style
  7. Button Place Alignments
  8. Different Ways to Boom
  9. Ease Animations for Buttons
  10. Different Order for Buttons
  11. Other Animations Attributes for Buttons
  12. Click Event and Listener
  13. Control BMB
  14. Use BMB in Action Bar
  15. Use BMB in List
  16. Use BMB in Fragment
  17. Attributes for BMB or Pieces on BMB
  18. Cache Optimization & Boom Area
  19. Version History
  20. Structure for BMB