Recent Posts

Site Creator

By

By

By

Custom Linear Layout in Android

Posted on

Hello

Sometimes it becomes necessary to create a Custom Component and use that for creating UX of android application.

Neccesity

Real culprit is findViewById() call that is very heavy call and sometimes when you start profiling your android application using HierarchyViewer you come to know you layout is taking much time to render on screen.

Now as UI expectations get increases with application development , developer tends to make mistake of making a complex layout, resulting in complex view hierarchy. This complex view hierarchy takes time to render on screen.

Solution : Create custom components for the views.

We will be start with taking an example for customising LinearLayout.

you can use above custom component as regular UX component in you UI XML file. But what is its use.

there are many use of it suppose you are having a layout which expands or contracts dynamically depending upon the height of its children. you can use a custom linear layout and override onMeasure() method of it and definitely you can dynamically set height of custom linear layout on the basis of height of its children.

There can be several uses of Custom components in android.

Thanks

Happy Coding !.


Note : Dear Copy-Paste Community :).
Hope you are doing good.
If you are a software engineer study the material before copy pasting.

Else knowledge gets increased when it is shared.







Disclaimer: The aforesaid writeup by Relsell Global writer is for the general understanding of the readers. It does not render any professional advice or opinion.

SHARE THIS PAGE!