在rootview上使用Android的<merge> XML元素来获取活动的布局

woo*_*oot 5 performance android android-layout android-lint

我使用以下布局:

---------------------
FrameLayout
    .>>. FrameLayout
    .>>. FrameLayout
---------------------
Run Code Online (Sandbox Code Playgroud)

这个布局是在一些Activity使用上设置的setContentView().我只是运行lint来分析我的项目并得到以下消息:

MergeRootFrame: FrameLayout can be replaced with <merge> tag 
Run Code Online (Sandbox Code Playgroud)

我理解并在某些布局中使用merge元素但我无法理解如何在没有明显的父项合并时如何建议合并我的布局中的根元素,当我进行校正并运行它一切顺利但是出于某种原因,这感觉有点可疑.

谢谢!

woo*_*oot 5

阅读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"

回答我的问题q :)