MyTetra Share
Делитесь знаниями!
LayoutInflater
20.04.2017
15:13
Раздел: Android - Ресурсы - developer.android.com - API

LayoutInflater

public abstract class LayoutInflater 
extends Object 

java.lang.Object

   ↳

android.view.LayoutInflater


Instantiates a layout XML file into its corresponding View objects. It is never used directly. Instead, usegetLayoutInflater() or getSystemService(Class) to retrieve a standard LayoutInflater instance that is already hooked up to the current context and correctly configured for the device you are running on. For example:

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

To create a new LayoutInflater with an additional LayoutInflater.Factory for your own views, you can usecloneInContext(Context) to clone an existing ViewFactory, and then call setFactory(LayoutInflater.Factory) on it to include your Factory.

For performance reasons, view inflation relies heavily on pre-processing of XML files that is done at build time. Therefore, it is not currently possible to use LayoutInflater with an XmlPullParser over a plain XML file at runtime; it only works with an XmlPullParser returned from a compiled resource (R.something file.)

See also:

 
MyTetra Share v.0.52
Яндекс индекс цитирования