Search code examples
androidandroid-framelayoutandroid-relativelayoutandroid-viewgroup

What is the purpose of FrameLayout and in which scenario should we use it?


What purpose does FrameLayout serve in Android? Is there any specific scenario for which it is designed for?

In my Android application, I have a scenario where I have to show two ImageViews, one over the other. This is a .png image file with a 9-patch drawable over this image.

Which ViewGroup should I use for this purpose: RelativeLayout or FrameLayout?

I also want to know the different scenarios that each of the ViewGroups should be used for.


Solution

  • Yes, you can use a FrameLayout in your scenario.