TAILIEUCHUNG - Lập trình Androi part 33

Nếu bạn có rất nhiều ưu đãi cho người dùng để thiết lập, đưa tất cả đều trong một danh sách lớn có thể không có ý tưởng tốt nhất. khung ưu đãi của Android mang đến cho bạn một số cách để áp đặt một chút về cấu trúc trên túi của bạn về sở thích, bao gồm loại và màn hình. | CHAPTER 21 Using Preferences Figure 21-3. The Simple project s list of saved preferences Adding a Wee Bit o Structure If you have a lot of preferences for users to set putting them all in one big list may not be the best idea. Android s preference framework gives you a few ways to impose a bit of structure on your bag of preferences including categories and screens. Categories are added via a Preferencecategory element in your preference XML and are used to group together related preferences. Rather than have your preferences all as children of the root Preferencescreen you can place a few Preferencecategory elements in the Preferencescreen and then put your preferences in their appropriate categories. Visually this adds a divider with the category title between groups of preferences. If you have a whole lot of preferences more than are convenient for users to scroll through you can also put them on separate screens by introducing the Preferencescreen element. Yes that Preferencescreen element. Any children of Preferencescreen go on their own screen. If you nest Preferencescreens the parent screen displays the screen as a placeholder entry and tapping that entry brings up the child screen. For example from the Prefs structured sample project here is a preference XML file that contains both Preferencecategory and nested Preferencescreen elements Preferencescreen xmlns android http apk res android PreferenceCategory android title Simple Preferences checkBoxPreference android key checkbox android title Checkbox Preference android summary Check it on check it off RingtonePreference android key ringtone android title Ringtone Preference android showDefault true android showSilent true android summary Pick a tone any tone PreferenceCategory PreferenceCategory android title Detail Screens PreferenceScreen android key detail android title Detail Screen android summary Additional preferences held in another page CheckBoxPreference android key checkbox2 .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.