0

I am using many activities with one common fab button on all activities. and there is at-lest 10 button and all having click listener so i don't wanna do same code again and again using include layout. is there any solution to show fab button on all activities.

Set one fab button on all activities without changing in there layout. without using <include> again and again. and that fab button open circular other fab button.

i know one solution by using windows manger class but this solution is not to be success. when app goes in background it show on screen. because of windows manager class property. how to remove that button when it goes background and when come in foreground it again show. and remove it when app is destroy.

I my app i am using one base activity which extend all activities.

thanks in advance.

jophab
  • 5,356
  • 14
  • 41
  • 60
Ajay Singh
  • 11
  • 1
  • not sure why the down vote, this definitely doesn't qualify for `This question does not appear to be about programming`. – marmor Dec 05 '16 at 07:20

1 Answers1

1

One way of doing it is by creating the FAB button programmatically instead of via XML layout.

You could create some helper class with a method to add a FAB button, and call that method from all your activities' onCreate method.

Here's how to create a FAB programmatically: https://stackoverflow.com/a/34556267/819355

Community
  • 1
  • 1
marmor
  • 27,641
  • 11
  • 107
  • 150