What is fragment?

Asked 14-Apr-2022
Viewed 504 times

1 Answer


0

  • A Fragment is a reusable part of your app's user interface. A fragment has its own layout and lifetime, as well as the ability to handle its own input events. Fragments cannot exist without the assistance of an activity or another fragment. The view hierarchy of the fragment merges with, or attaches to, the view hierarchy of the host.
  • By dividing the UI into separate sections, fragments add modularity and reusability to your activity's UI. Activities are a great area to integrate global components like a navigation drawer throughout your app's user interface. Fragments, on the other hand, are better for defining and managing the UI of a single screen or piece of a screen.


Read More: What is AAPT?