开发者

How to define "inflation" in Android

开发者 https://www.devze.com 2023-02-24 09:46 出处:网络
I\'m trying to learn Android and I don\'t understand what Inflate real开发者_开发知识库ly does. I\'ve seen different examples on which it is used for inserting a layout inside another but I\'m not sur

I'm trying to learn Android and I don't understand what Inflate real开发者_开发知识库ly 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?


"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.


Simply understanding: "inflate" is a term in Android to convert a layout XML file into its corresponding View objects. It is used in menuInflater.inflate(...) or layoutInflater.inflate(...)

0

精彩评论

暂无评论...
验证码 换一张
取 消