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?
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.
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.
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With