Android: What is an inflatable item in a list?

I try to understand the inflator in the list, but did not understand. can anyone explain this with a simple example. Thanks in advance.

+4
source share
2 answers

In a nutshell, this class is used to inflate the XML data that defines Views and ViewGroups. Inflation is a process that includes: analysis of layout XML-layouts, creation of corresponding View objects and their addition to the presentation hierarchy.

This is used to instantiate the XML layout file into the corresponding View objects. It is never used directly - use getLayoutInflater () or getSystemService (String) to get a standard instance of LayoutInflater that is already connected to the current context and correctly configured for the device you are working on. For instance:

LayoutInflater inflater = (LayoutInflater)context.getSystemService (Context.LAYOUT_INFLATER_SERVICE); 

Learn more about this here. Android Layout Resources

+2
source

Inflater in ListView inflates the layout of each list item. You can customize the layout as one of the standard layouts or create your own layout.

0
source

Source: https://habr.com/ru/post/1382427/


All Articles