Learning notes for open-source Chinese Android (1) use of preferences. xml

Source: Internet
Author: User

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.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.