6

I am using the following layout:

---------------------
FrameLayout
    .>>. FrameLayout
    .>>. FrameLayout
---------------------

This layout is set on some Activity using setContentView(). I just run lint to analyse my project and got the following message:

MergeRootFrame: FrameLayout can be replaced with <merge> tag 

I understand and use the merge element in certain layouts but I fail to understand how can I be advised to merge the root element in my layout when there is no obvious parent to merge with, when I do the correction and run it all goes well but for some reason this feels a bit fishy.

Thanks!

woot
  • 3,671
  • 4
  • 26
  • 39

2 Answers2

6

Read the following post by Romain Guy: http://www.curious-creature.org/2009/03/01/android-layout-tricks-3-optimize-part-1/

"the parent of an activity’s content view is always a FrameLayout"

Answered my question q:)

woot
  • 3,671
  • 4
  • 26
  • 39
1

The window provided for your application by the system has a FrameLayout that is the parent for your Activity's view hierarchy.

Karakuri
  • 38,365
  • 12
  • 84
  • 104
  • Is this documented somewhere? or are you just stating a fact by looking at HierarchyViewer or something? – woot Jul 03 '13 at 15:18
  • I'm not sure if it's documented anywhere, but I've only ever seen a FrameLayout as the parent view of an Activity's view hierarchy. – Karakuri Jul 03 '13 at 18:31