TAILIEUCHUNG - Lập trình Androi part 09

Như tên cho thấy, GridView cung cấp cho bạn một lưới hai chiều của các từ đó để lựa chọn. Bạn có quyền kiểm soát vừa qua số lượng và kích thước của các cột; số hàng được tự động xác định dựa trên số lượng các hạng mục của adapter cung cấp nói có sẵn để xem | CHAPTER 7 Using Selection Widgets Figure 7-5. The same application with the spinner drop-down list displayed Grid Your Lions or Something Like That. As the name suggests GridView gives you a two-dimensional grid of items from which to choose. You have moderate control over the number and size of the columns the number of rows is dynamically determined based on the number of items the supplied adapter says are available for viewing. When combined a few properties determine the number of columns and their sizes android numColumns Specifies how many columns there are or if you supply a value of auto_fit Android will compute the number of columns based on the available space and the following properties. android verticalSpacing and android horizontalSpacing Indicate how much whitespace there should be between items in the grid. android columnWidth Indicates how many pixels wide each column should be. android stretchMode Indicates for grids with auto_fit for android numColumns what should happen for any available space not taken up by columns or spacing. This can be columnWidth to have the columns take up available space or spacingWidth to have the whitespace between columns absorb extra space. For example suppose the screen is 320 pixels wide and you have android columnWidth set to 100px and android horizontalSpacing set to 5px. Three columns would use 310 pixels three columns of 100 pixels and two whitespace areas of 5 pixels . With CHAPTER 7 Using Selection Widgets 7 android stretchMode set to columnWidth the three columns will each expand by 3 to 4 pixels to use up the remaining 10 pixels. With android stretchMode set to spacingWidth the two whitespace areas will each grow by 5 pixels to consume the remaining 10 pixels. Otherwise the GridView works much like any other selection widget use setAdapter to provide the data and child views invoke setOnItemSelectedListener to register a selection listener and so on. For example here is a XML layout from the Selection .

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.