I specially created a bottom bar design. I have 3 activities and for each activity, the background of the menu in this bottom bar will change, for example; While the user is in 1.activty, the background of the 1st menu in the bottomBar will change, then the background of the 2nd menu in the bottomBar will change when in 2.activty
it is very difficult to do this for every activity and sometimes it can get messy so I want to make a design and a module where this design is managed. but i don't know how i can do this.. i would be very happy if you give an example. (whichever button is pressed needs to go to that activity and change the background) Please review;
CodePudding user response:
You shouldn't be making separate versions of that for each Activity. That should be a single custom View, with one view set as the selected view which gets a dark background. Then you just need to include that custom view in each of the 3 activities with the proper view set as selected. Then you have 1 java class defining the custom view, 1 xml file defining the layout of this view, and in each activity's xml file you include this view.
CodePudding user response:
The best way to handle this scenario would be to use 3 fragments instead of Activities. That way the bottombar will be common and you can control its views directly in the activity. You can use viewPager or Navigation Component to manage the navigation between the Fragments. You can checkout this link for Navigation Components