TAILIEUCHUNG - Android (phần 5)

Introducing Adapters ❘ 167 3. If you run the Activity it will now display each to-do item as shown in Figure 5-3. FIGURE 5-3 4. Now you can create a custom layout to display each to-do item. Start by modifying the custom layout you created in Chapter 4 to include a second TextView. It will be used to show the creation date of each to-do item. | Introducing Adapters 167 3. If you run the Activity it will now display each to-do item as shown in Figure 5-3. FIGURE 5-3 4. Now you can create a custom layout to display each to-do item. Start by modifying the custom layout you created in Chapter 4 to include a second Textview. It will be used to show the creation date of each to-do item. xml version encoding utf-8 RelativeLayout xmlns android http apk res android android layout_width fill_parent android layout_height fill_parent android background @color notepad_paper TextView android id @ id rowDate android layout_width wrap_content android layout_height fill_parent android padding 10dp android scrollbars vertical android fadingEdge vertical android textColor @color notepad_text android layout_alignParentRight true TextView android id @ id row android layout_width fill_parent android layout_height fill_parent android padding 10dp android scrollbars vertical android fadingEdge vertical android textColor @color notepad_text android layout_alignParentLeft @ id rowDate RelativeLayout 168 CHAPTER 5 INTENTS BROADCAST RECEIVERS ADAPTERS AND THE INTERNET 5. Create a new class ToDoItemAdapter that extends an ArrayAdapter with a ToDoItem-specific variation. Override getview to assign the task and date properties in the ToDoitem object to the Views in the layout you created in Step 4 import import import . import . import . public class ToDoItemAdapter extends ArrayAdapter ToDoItem int resource public ToDoItemAdapter Context _context int _resource List ToDoItem _items super _context _resource _items resource _resource Override public View getview int position View convertview ViewGroup parent LinearLayout todoView ToDoitem item getitem position String taskstring Date createdDate SimpleDateFormat sdf new SimpleDateFormat dd MM yy String datestring createdDate if convertView .

TỪ KHÓA LIÊN QUAN
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.