Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is MergeRootFrame in FrameLayout?

In FrameLayout of XML we have an attribute by name tools:ignore="MergeRootFrame", what is MergeRootFrame ?

like image 366
A.A Avatar asked Nov 12 '14 05:11

A.A


People also ask

What's the purpose of FrameLayout?

FrameLayout is designed to block out an area on the screen to display a single item. Generally, FrameLayout should be used to hold a single child view, because it can be difficult to organize child views in a way that's scalable to different screen sizes without the children overlapping each other.

What does the tag in an XML layout file do?

The <include> tag lets you to divide your layout into multiple files: it helps dealing with complex or overlong user interface.


2 Answers

It's for the Lint tool. You're asking it to ignore (i.e. not show warnings for) the "MergeRootFrame" rule:

"MergeRootFrame": Checks whether a root <FrameLayout> can be replaced with a <merge> tag

like image 187
ipavl Avatar answered Oct 21 '22 08:10

ipavl


<tools> attributes is basically used as a shortcut to store information and facilitating Android platform with required conditions without further computation. "tools:ignore" is a statement which actually is telling Lint tool to ignore "issue id" - "MergeRootFrame".

based on ipavl's answer - <merge> tag is is basically used to remove multiple layers of viewgroups which are not required / degrades UI performance. this statement basically asks Lint to ignore warnings where, there are multiple redundant <framelayout>'s and this could be further optimized my replacing it with <merge>

This is explained here, beautifully - Warning: This <FrameLayout> can be replaced with a <merge> tag

Bottom line: Technically you are asking Lint to ignore warnings of this kind

Links:

http://tools.android.com/tech-docs/tools-attributes , https://developer.android.com/training/improving-layouts/reusing-layouts.html

like image 38
Arghya Avatar answered Oct 21 '22 07:10

Arghya