Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the view limit in Android xml layout

Anyone have any idea about that in android layout XML, What is the maximum view limit that can be embedded into the XML? Is there any limit?

like image 496
Faisal Khan Avatar asked Dec 08 '15 10:12

Faisal Khan


People also ask

What is view in Android XML?

A View occupies a rectangular area on the screen and is responsible for drawing and event handling. Views are used for Drawing Shapes like Circles,Rectangles,Ovals etc . Just Use View with background and apply a Shape using Custom Drawable.

What is a view in Android layout?

View is the base class for widgets, which are used to create interactive UI components like buttons, text fields, etc. The ViewGroup is a subclass of View and provides invisible container that hold other Views or other ViewGroups and define their layout properties.

What is Android XML layout?

Using Android's XML vocabulary, you can quickly design UI layouts and the screen elements they contain, in the same way you create web pages in HTML — with a series of nested elements. Each layout file must contain exactly one root element, which must be a View or ViewGroup object.

What an XML layout file contains?

The XML layout file contains at least one root element in which additional layout elements or widgets can be added to build a View hierarchy.


2 Answers

Strictly speaking the "limit" is 80.

Lint reports the following when you have too many views in a layout :-

AndroidLintTooManyViews

Description

Layout has too many views Using too many views in a single layout is bad for performance. Consider using compound drawables or other tricks for reducing the number of views in this layout. The maximum view count defaults to 80 but can be configured with the environment variable ANDROID_LINT_MAX_VIEW_COUNT.

However, I was using a table layout which blew my number of views by a few (mainly TextViews) and I have had no problems. I didn't bother to change the ANDROID_LINT_MAX_VIEW_COUNT variable.

like image 195
Simon Hutton Avatar answered Oct 18 '22 10:10

Simon Hutton


There are no certain things in android.You can use maximum views as much as you can.But one thing that needs to keep in mind, there should be maximum 3 level hierarchy.

like image 32
SoumyaRanjan Sahu Avatar answered Oct 18 '22 09:10

SoumyaRanjan Sahu