Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to define "inflation" in Android

I'm trying to learn Android and I don't understand what Inflate really does. I've seen different examples on which it is used for inserting a layout inside another but I'm not sure on where it is good to be used.

Can anyone help with good examples?

like image 314
Cris Avatar asked Apr 11 '11 17:04

Cris


People also ask

What is Android inflation?

"Inflation" is a term that refers to parsing XML and turning it into UI-oriented data structures. You can inflate a view hierarchy, a menu structure, and other types of resources. Often this is done behind the scenes by the framework (when you call setContentView(R. layout.

What does it mean to inflate a layout Android?

Layout inflation is the term used within the context of Android to indicate when an XML layout resource is parsed and converted into a hierarchy of View objects.

What is inflate in Kotlin?

In this article, you will learn how to inflate one layout in another at Runtime using Kotlin in Android. To populate very few items, we can embed or inflate them on runtime. But for a long list, its always better to use RecyclerView. Following is the basic code to inflate one layout in another in Kotlin.

What does Inflater inflate do?

inflater.inflate will -Inflate a new view hierarchy from the specified xml resource. Throws InflateException if there is an error. In simple terms inflater. inflate is required to create view from XML .


1 Answers

"Inflation" is a term that refers to parsing XML and turning it into UI-oriented data structures. You can inflate a view hierarchy, a menu structure, and other types of resources. Often this is done behind the scenes by the framework (when you call setContentView(R.layout.main), for instance). A typical case when you explicitly inflate something yourself is when creating menus, as described in the guide subject Creating Menus.

like image 129
Ted Hopp Avatar answered Oct 20 '22 00:10

Ted Hopp