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
  • Change Boom Buttons Dynamically

Change Boom Buttons Dynamically · Changes

Page history
Updated Change Boom Buttons Dynamically (markdown) authored Apr 07, 2017 by Weiping Huang's avatar Weiping Huang
Hide whitespace changes
Inline Side-by-side
Change-Boom-Buttons-Dynamically.md
View page @ 22ca843c
......@@ -5,9 +5,14 @@ From version 2.0.9, you can change contents in boom-buttons by changing them in
builder.normalText("Changed!");
builder.normalTextColor(Color.YELLOW);
```
The text and its color will be changed even when the boom-button is boomed. Check [the demo activity](https://github.com/Nightonke/BoomMenu/blob/master/app/src/main/java/com/nightonke/boommenusample/ChangeBoomButtonActivity.java) for more details.
**But notice**, not every method can do that magic!
The text and its color will be changed even when the boom-button is boomed. In this way, the new attributes of the boom-button are stored in builders too, which means the next time when the boom-buttons boom, the contents are the new ones. Check [the demo activity](https://github.com/Nightonke/BoomMenu/blob/master/app/src/main/java/com/nightonke/boommenusample/ChangeBoomButtonActivity.java) for more details.
**But notice**, not every method can do that magic! Only the methods of builder whose comment contains a `Synchronicity` tag can meet the demand:
<img src="https://github.com/Nightonke/BoomMenu/blob/master/Pictures/Synchronicity.png" width=500>
The lazy developer will make all methods to support this feature as soon as possible. If you found some methods should support that but not, tell the developer in issues.
### Change Contents from Raw Widget
You can get the children views of a boom button by the following codes:
```
BoomButton boomButton = bmb.getBoomButton(i);
......@@ -19,4 +24,4 @@ if (text != null) text.setText("I'm changed!");
TextView subText = boomButton.getSubTextView();
if (subText != null) subText.setText("I'm changed, too!");
```
Notice that the children views and the boom button itself maybe null because boom buttons are cleared in some situation(in list, in fragment, etc.). So you have to check whether they are available. Check the [demo](https://github.com/Nightonke/BoomMenu/blob/master/app/src/main/java/com/nightonke/boommenusample/ChangeBoomButtonActivity.java) for more details.
\ No newline at end of file
Notice that the children views and the boom button itself **maybe null** because boom buttons are cleared in some situation(in list, in fragment, etc.). So you have to check whether they are available. In this way, the attributes are **NOT** stored in builders. So the next time when booming, the contents may be the old ones, if the attributes-changed-boom-buttons are recovered.
\ No newline at end of file
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 Tool Bar
  16. Use BMB in List
  17. Use BMB in Fragment
  18. Attributes for BMB or Pieces on BMB
  19. Cache Optimization & Boom Area
  20. Version History
  21. Structure for BMB
  22. Change Boom Buttons Dynamically