

Separating the navigation elements from the content can make this

Managing all of these variations in the activity can be Smaller screens, the app should display a bottom navigation bar and a list inĪ linear layout. On larger screens, theĪpp should display a static navigation drawer and a list in a grid layout. Manage the UI of a single screen or portion of a screen.Ĭonsider an app that responds to various screen sizes.

Conversely, fragments are better suited to define and Place to put global elements around your app's user interface, such as a Note: Some Android Jetpack libraries, such asįragments introduce modularity and reusability into your activity’s UI byĪllowing you to divide the UI into discrete chunks. The fragment’s view hierarchy becomes part of, or attaches to, FragmentsĬannot live on their own-they must be hosted by an activity or anotherįragment. Layout, has its own lifecycle, and can handle its own input events.
