TAILIEUCHUNG - Bắt Đầu Với Android (P.2)

Tham khảo tài liệu 'bắt đầu với android ()', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Page 27 Thursday April 9 2009 5 35 PM CHAPTER 6 Employing Basic Widgets EveryGUI toolkit has some basic widgets fields labels buttons etc. Android s toolkit is no different in scope and the basic widgets will provide a good introduction as to how widgets work in Android activities. Assigning Labels The simplest widget is the label referred to in Android as a TextView. Like in most GUI toolkits labels are bits of text not editable directly by users. Typically they are used to identify adjacent widgets . a Name label before a field where one fills in a name . In Java you can create a label by creating a TextView instance. More commonly though you will create labels in XML layout files by adding a TextView element to the layout with an android text property to set the value of the label itself. If you need to swap labels based on certain criteria such as internationalization you may wish to use a resource reference in the XML instead as will be described in Chapter 9. TextView has numerous other properties of relevance for labels such as android typeface to set the typeface to use for the label . monospace android textStyle to indicate that the typeface should be made bold bold italic italic or bold and italic bold_italic android textColor to set the color of the label s text in RGB hex format . FF0000 for red For example in the Basic Label project you will find the following layout file xml version encoding utf-8 TextView xmlns android http apk res android android layout_width fill_parent android layout_height wrap_content android text You were expecting something profound 27 Page 28 Thursday April 9 2009 5 35 PM 28 CHAPTER 6 EMPLOYING BASIC WIDGETS As you can see in Figure 6-1 just that layout alone with the stub Java source provided by Android s project builder . activityCreator gives you the application. Figure 6-1. The LabelDemo sample application Button Button Who s Got the Button We ve

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.