TAILIEUCHUNG - Lập trình Androi part 14

Cách tiếp cận điển hình cho người dùng lưu giữ thông báo về tiến độ là để hiển thị một số hình thức thanh tiến trình, hoặc throbber "" (như phim hoạt hình đồ họa xuất hiện gần góc trên bên phải của trình duyệt web nhiều). Android hỗ trợ này thông qua các widget ProgressBar | CHAPTER 9 Employing Fancy Widgets and Containers Making Progress If you need to be doing something for a long period of time you owe it to your users to do two things Use a background thread. Keep them apprised of your progress lest they think your activity has wandered away and will never come back. The typical approach to keeping users informed of progress is to display some form of progress bar or throbber like the animated graphic that appears near the upper-right corner of many web browsers . Android supports this through the ProgressBar widget. A ProgressBar widget keeps track of progress defined as an integer with 0 indicating no progress has been made. You can define the maximum end of the range the value that indicates progress is complete via setMax . By default ProgressBar starts with a progress of 0 though you can start from some other position via setProgress . If you prefer your progress bar to be indeterminate use setIndeterminate setting it to true. In your Java code you can either positively set the amount of progress that has been made via setProgress or increment the progress from its current amount via incrementProgressBy . You can find out how much progress has been made via getProgress . Since the ProgressBar is tied closely to the use of threads a background thread doing work updating the UI thread with new progress information its use is demonstrated in Chapter 15. Seeking Resolution A subclass of ProgressBar is SeekBar. A ProgressBar is an output widget telling the user how much progress has been made. Conversely the SeekBar is an input widget allowing the user to select a value along a range of possible values as shown in Figure 9-6. CHAPTER 9 Employing Fancy Widgets and Containers Figure 9-6. The Views SeekBar API demo from the Android SDK The user can drag the thumb or click either side of it to reposition the thumb. The thumb then points to a particular value along a range. That range will be 0 to some maximum value 100 by default .

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.