質問

I've gone through some docs and It basically tells that

  • Although you see XML when writing your program, the Eclipse plug-in invokes the Android resource compiler, aapt, to preprocess the XML into a compressed binary format.**It is this format, not the original XML text, that is stored on the device
  • 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.)

Does the XML Layout goes as an argument to setContentView(R.something.file); in binary format? When does the Inflation takes place?, Who implements XmlPullParser interface and when does it work in setContentView(R.something.file) method?

役に立ちましたか?

解決

Does the XML Layout goes as an argument to setContentView(R.something.file); in binary format?

The XML layout file, like all resources written in XML format, is stored in the APK file in a "compressed binary format".

When does the Inflation takes place?

In the case of layout XML resources, inflation takes place when somebody calls inflate() on a LayoutInflater. setContentView() uses a LayoutInflater to inflate() the layout XML resource you supply as a parameter.

Who implements XmlPullParser interface

Whoever wants to.

and when does it work?

Whenever anyone asks an instance of an implementation of the interface to work.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top