TAILIEUCHUNG - Lập trình Androi part 10

Các ListView khiêm tốn là một trong những vật dụng quan trọng nhất trong tất cả các Android, đơn giản chỉ vì nó được sử dụng như vậy thường xuyên. Cho dù lựa chọn một số liên lạc để gọi, tin nhắn e-mail để chuyển tiếp, hoặc một cuốn sách điện tử để đọc, vật dụng ListView được tuyển dụng trong một loạt các hoạt động. Tất nhiên, nó sẽ được tốt đẹp nếu họ đã được nhiều hơn đồng bằng văn bản chỉ | Chapter Getting Fancy with Lists The humble ListView is one of the most important widgets in all of Android simply because it is used so frequently. Whether choosing a contact to call an e-mail message to forward or an e-book to read ListView widgets are employed in a wide range of activities. Of course it would be nice if they were more than just plain text. The good news is that Android lists can be as fancy as you want within the limitations of a mobile device s screen obviously . However making them fancy takes some work as you will learn in this chapter. Getting to First Base The classic Android ListView is a plain list of text solid but uninspiring. We hand the ListView a bunch of words in an array and then tell Android to use a simple built-in layout for pouring those words into a list. However you can have a list whose rows are made up of icons icons and text check boxes and text or whatever you want. It is merely a matter of supplying enough data to the adapter and helping the adapter to create a richer set of View objects for each row. For example suppose we want a ListView whose entries are made up of an icon followed by some text. We could construct a layout for the row that looks like this found in the FancyLists Static sample project xml version encoding utf-8 LinearLayout xmlns android http apk res android android layout_width fill_parent android layout_height wrap_content android orientation horizontal ImageView android id @ id icon android layout_width 22px android paddingLeft 2px android paddingRight 2px android paddingTop 2px android layout_height wrap_content android src @drawable ok 75 6 CHAPTER 8 Getting Fancy with Lists TextView android id @ id label android layout_width wrap_content android layout_height wrap_content android textSize 44sp LinearLayout This layout uses a LinearLayout to set up a row with the icon on the left and the text in a nice big font on the right. However by default Android has no idea that we .

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.