0

What are the advantages of using nested layouts in android? Why not just use layouts without nesting? It is usually seen in 'compose message' activity layout. Coders use nested layouts to place the 'send' button in the bottom. Why not just as it is place it in the last?

Ayushi Singh
  • 3
  • 1
  • 5

1 Answers1

1

The reason you'd want to nest a layout is the same reason you'd create a separate class/method to do specific things. It breaks apart your code and organizes it better. The nested layout would be something you might modify more frequently, while the layout that holds it would stay static (for the most part).

A good example would be if you create a brand new project in android studio 1.4, it creates two activities for main. One has all your floating action button (fab) and all, the other is for your formatting. If you don't want to touch the fab, then you don't have to, you only have to deal with your layout, it also looks a lot cleaner, which makes it easier to edit.

Spider
  • 431
  • 7
  • 21