TAILIEUCHUNG - Lập trình Androi part 27

Một số thiết bị cầm tay Android, giống như T-Mobile G1, cung cấp một bàn phím trượt kích hoạt xoay màn hình từ bức chân dung để định hướng phong cảnh. thiết bị cầm tay khác có thể sử dụng gia tốc để xác định xoay màn hình, như iPhone, không có gì. Kết quả là, nó là hợp lý để giả định rằng bức chân dung để chuyển đổi từ định hướng cảnh quan và ngược lại có thể là một cái gì đó người dùng của bạn sẽ muốn làm | Chapter Handling Rotation Some Android handsets like the T-Mobile G1 offer a slide-out keyboard that triggers rotating the screen from portrait to landscape orientation. Other handsets might use accelerometers to determine screen rotation as the iPhone does. As a result it is reasonable to assume that switching from portrait to landscape orientation and back again may be something your users will want to do. As you ll learn in this chapter Android has a number of ways for you to handle screen rotation so your application can properly handle either orientation. But realize that these facilities just help you detect and manage the rotation process. You are still required to make sure you have layouts that look decent in each orientation. A Philosophy of Destruction By default when there is a change in the phone configuration that might affect resource selection Android will destroy and re-create any running or paused activities the next time they are to be viewed. While this could happen for a variety of different configuration changes . change of language selection it is most likely to trip you up for rotations since a change in orientation can cause you to load a different set of resources . layouts . The key here is that this is the default behavior. It may even be the behavior that is best for one or more of your activities. You do have some control over the matter though and can tailor how your activities respond to orientation changes or similar configuration switches. It s All the Same Just Different Since by default Android destroys and re-creates your activity on a rotation you may only need to hook into the same onSaveInstanceState that you would if your activity were destroyed for any other reason . low memory . Implement that method in your activity and fill in the supplied Bundle with enough information to get you back to your current state. Then in onCreate or onRestoreInstanceState if you prefer pick the data out of the Bundle and use it to .

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.