DEV Community

Discussion on: Android Views: Peek-A-Boo

Collapse
 
kostassar profile image
Kostas Sar

So does this mean that you could write the whole app in your main view by switching each component's visibility value?

Collapse
 
pabiforbes profile image
Pabi Moloi, but Forbes

From a best practise point of view, I do not think that this is a good idea. In my opinion, it's best to have fragments, and swap those in and out of the main view.

Collapse
 
ditn profile image
Adam Bennett

People do actually do this sometimes - when Fragments went out of vogue a lot of people switched to using Compound Views/ViewGroups with their own View Controller/Presenters and just switched the visibility in the Activity.

It works fairly well for a handful of pages (say, bottom nav bar pages), but you wouldn't do an entire app this way - especially now that Support Fragments are actually good and the recommended way of doing it.