TAILIEUCHUNG - Lập trình Androi part 53

Tuy nhiên, Android sẽ tự động quy mô bitmap nguồn lực, ngay cả với và các thuộc tính của nó thiết lập là true. Cộng với bên trên, có nghĩa là bạn có thể không cần làm bất cứ điều gì với các bitmap. Tuy nhiên, bạn đang dựa vào một thiết bị để làm các việc nhân rộng, mà chắc chắn CPU chi phí thời gian (và, do đó, tuổi thọ pin). Ngoài ra, các thuật toán tỉ lệ sử dụng thiết bị đó có thể không được tối ưu, so với những gì bạn có thể làm. | CHAPTER 36 Handling Multiple Screen Sizes Figure 36-44. EU4You original version QVGA Fixing the Fonts The first problem that should be fixed is the font size. As you can see with a fixed 20-pixel size the font ranges from big to tiny depending on screen size and density. For a WVGA screen the font may be rather difficult to read. We could put the dimension as a resource res values and have different versions of that resource based on screen size or density. However it is simpler to just specify a density-independent size such as 5mm as seen in the ScreenSizes EU4You_2 project xml version encoding utf-8 LinearLayout xmlns android http apk res android android layout_width fill_parent android layout_height wrap_content android padding 2dip android minHeight android attr listPreferredItemHeight ImageView android id @ id flag android layout_width wrap_content android layout_height wrap_content android layout_gravity center_vertical left android paddingRight 4px TextView android id @ id name android layout_width wrap_content android layout_height wrap_content android layout_gravity center_vertical right android textSize 5mm LinearLayout CHAPTER 36 Handling Multiple Screen Sizes Figures 36-5 36-6 and 36-7 shows the results on HVGA WVGA and QVGA screens. Figure 36-5. EU4You 5mm font version HVGA Figure 36-6. EU4You 5mm font version WVGA 800x480 pixels CHAPTER 36 Handling Multiple Screen Sizes Figure 36-7. EU4You 5mm font version QVGA Now our font is a consistent size and large enough to match the flags. Fixing the Icons So what about those icons They should be varying in size as well since they are the same for all three emulators. However Android automatically scales bitmap resources even with supports-screens and its attributes set to true. On the plus side this means you may not need to do anything with these bitmaps. However you are relying on a device to do the scaling which definitely costs CPU time and hence battery life . Also .

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.