Finally, I copied the open-source Chinese code to the ADT and saw countless source codes. I was dizzy. So I decided to annotate each piece of code to help me better learn android.
Seeing a lot of files with the suffix XML, I decided to keep it simple and complex. So this first article was written to RES \ preferences. xml.
In contrast to the open-source China of mobile phones, this code is written in system settings. First, we can see a pair of <preferencescreen> labels, which contain four pairs of <preferencecategory> labels. <Preferencescreen> the label is used to set the interface display. <Preferencecategory> labels can be translated as the first option. The first <preferencecategory> label is used as an example:
<Preferencecategory Android: Layout = "@ layout/preference_category" Android: Title = "Account Management"> <preference Android: Layout = "@ layout/preference" Android: title = "User Login" Android: Key = "Account"/> <preference Android: Layout = "@ layout/preference" Android: Title = "My Documents" Android: key = "myinfo" Android: Summary = "my information, favorites, fans... "/> </preferencecategory>
Compare with the image:
Android: title indicates the title.
Two <preference> labels are built in as the second-level interface.
Android: Key is equivalent to ID.
Android: summary can be used as a small font.
In fact, this code page is used to generate a preference interface by calling the XML in Java source code. (This Java source file is not found yet. You can add it later)
For more information about the </preferencecategory> application.
OK, not finished yet.