With Fragments now available as part of the Android support library, t dịch - With Fragments now available as part of the Android support library, t Việt làm thế nào để nói

With Fragments now available as par

With Fragments now available as part of the Android support library, they provide a more encapsu¬lated alternative to parallelized components.
Rather than duplicating Activities, use Fragments — combined with the resource hierarchy — to create a consistent UI that’s optimized for different platform releases and hardware configurations.
Most of the UI logic for your Activities should be contained within individual Fragments rather than the Activity itself. As a result, you need only create alternative Fragments to expose and utilize different functionality and inflate
different versions of the same layout stored within their respective res/layout-v[API level] folders.
Interaction between and within Fragments is usually maintained within each Fragment, so only code related to missing APIs will need to be changed within the Activity. If each variation of a Fragment implements the same interface definition and ID, you shouldn’t need to create multiple Activities to support multiple layouts and Fragment definitions.
OPTIMIZING UI PERFORMANCE WITH STRICT MODE
The resource-constrained nature of mobile devices amplifies the effect of performing time-consum¬ing operations on the main application thread. Accessing network resources, reading or writing files, or accessing databases while blocking the UI thread can have a dramatic impact on the user experi¬ence, causing your application to become less smooth, more laggy, and, in the most extreme case, unresponsive.
You learned how to move such time-consuming operations onto background threads in Chapter 9. Strict Mode (introduced in Android 2.3 (API level 9) is a tool that helps you identify cases you may have missed.
Using the Strict Mode APIs, you can assign a set of policies that monitor actions within your appli¬cation and define how you should be alerted. You can define policies related to either the current application thread or to your application’s virtual machine (VM) process. The former is perfect for detecting slow operations being performed on the UI thread, whereas the latter helps you detect memory and Context leaks.
To use Strict Mode, create a new ThreadPolicy class and a new VmPolicy class, using their static builder classes with the detect* methods to define the actions to monitor. The corresponding penalty* methods control how the system should react to detecting those actions.
The Thread Policy can be used to detect disk reads/writes and network access, whereas the Vm Policy can monitor your application for Activity, SQLite, and closeable object leaks.
The penalties available to both policies include logging or application death, while the Thread Policy also supports displaying an on-screen dialog or flashing screen border.
Both builder classes also include a detectAll method that includes all the possible monitoring options supported by the host platform. You can also use the strictMode.enableDefaults method to apply the default monitoring and penalty options.
To enable Strict Mode across your entire application, you should extend the Application class, as shown in Listing 18-19.
0/5000
Từ: -
Sang: -
Kết quả (Việt) 1: [Sao chép]
Sao chép!
With Fragments now available as part of the Android support library, they provide a more encapsu¬lated alternative to parallelized components.Rather than duplicating Activities, use Fragments — combined with the resource hierarchy — to create a consistent UI that’s optimized for different platform releases and hardware configurations.Most of the UI logic for your Activities should be contained within individual Fragments rather than the Activity itself. As a result, you need only create alternative Fragments to expose and utilize different functionality and inflate different versions of the same layout stored within their respective res/layout-v[API level] folders.Interaction between and within Fragments is usually maintained within each Fragment, so only code related to missing APIs will need to be changed within the Activity. If each variation of a Fragment implements the same interface definition and ID, you shouldn’t need to create multiple Activities to support multiple layouts and Fragment definitions.OPTIMIZING UI PERFORMANCE WITH STRICT MODEThe resource-constrained nature of mobile devices amplifies the effect of performing time-consum¬ing operations on the main application thread. Accessing network resources, reading or writing files, or accessing databases while blocking the UI thread can have a dramatic impact on the user experi¬ence, causing your application to become less smooth, more laggy, and, in the most extreme case, unresponsive.You learned how to move such time-consuming operations onto background threads in Chapter 9. Strict Mode (introduced in Android 2.3 (API level 9) is a tool that helps you identify cases you may have missed.
Using the Strict Mode APIs, you can assign a set of policies that monitor actions within your appli¬cation and define how you should be alerted. You can define policies related to either the current application thread or to your application’s virtual machine (VM) process. The former is perfect for detecting slow operations being performed on the UI thread, whereas the latter helps you detect memory and Context leaks.
To use Strict Mode, create a new ThreadPolicy class and a new VmPolicy class, using their static builder classes with the detect* methods to define the actions to monitor. The corresponding penalty* methods control how the system should react to detecting those actions.
The Thread Policy can be used to detect disk reads/writes and network access, whereas the Vm Policy can monitor your application for Activity, SQLite, and closeable object leaks.
The penalties available to both policies include logging or application death, while the Thread Policy also supports displaying an on-screen dialog or flashing screen border.
Both builder classes also include a detectAll method that includes all the possible monitoring options supported by the host platform. You can also use the strictMode.enableDefaults method to apply the default monitoring and penalty options.
To enable Strict Mode across your entire application, you should extend the Application class, as shown in Listing 18-19.
đang được dịch, vui lòng đợi..
Kết quả (Việt) 2:[Sao chép]
Sao chép!
Với mảnh vỡ tại có sẵn như là một phần của thư viện hỗ trợ Android, họ cung cấp một thay thế encapsu¬lated hơn với các thành phần song song.
Thay vì là nhân đôi hoạt động, sử dụng mảnh vỡ - kết hợp với hệ thống phân cấp tài nguyên - để tạo ra một giao diện người dùng phù hợp tối ưu hóa cho phiên bản nền tảng khác nhau và cấu hình phần cứng.
Hầu hết các logic UI cho hoạt động của bạn phải được chứa trong Fragments cá nhân chứ không phải là các Hoạt động chính nó. Kết quả là, bạn chỉ cần tạo ra mảnh vỡ khác để phơi bày và sử dụng các chức năng khác nhau và thổi phồng
các phiên bản khác nhau của cùng một bố trí được lưu trữ trong res của mình / layout-v [cấp API] thư mục.
Tương tác giữa và trong các mảnh vỡ thường được duy trì trong mỗi Fragment , do đó, chỉ liên quan đến tiến API mất tích sẽ cần phải được thay đổi trong hoạt động. Nếu mỗi biến thể của một Fragment thực hiện các định nghĩa giao diện tương tự và ID, bạn không cần phải tạo ra nhiều hoạt động hỗ trợ nhiều layout và định nghĩa Fragment.
Tối ưu hóa giao diện người dùng THI VỚI PHƯƠNG THỨC nghiêm ngặt
Bản chất nguồn lực hạn chế của các thiết bị di động khuếch đại hiệu quả của việc thực hiện thời gian consum¬ing hoạt động trên thread ứng dụng chính. Truy cập vào tài nguyên mạng, đọc hoặc viết các tập tin, hoặc truy cập vào cơ sở dữ liệu trong khi chặn thread UI có thể có một tác động đáng kể trên experi¬ence người dùng, làm ứng dụng của bạn để trở thành kém mịn, lag hơn, và, trong trường hợp cực đoan nhất, không phản hồi.
bạn đã học được làm thế nào để chuyển hoạt động tốn nhiều thời gian như vậy vào đề nền trong Chương 9. Chế độ nghiêm ngặt (giới thiệu trong Android 2.3 (API cấp 9) là một công cụ giúp bạn xác định trường hợp, bạn có thể bỏ qua.
Sử dụng các API chế độ nghiêm ngặt, bạn có thể gán một bộ chính sách mà theo dõi hành động trong appli¬cation của bạn và xác định cách bạn nên báo trước. bạn có thể xác định các chính sách liên quan đến một trong hai chủ đề ứng dụng hiện tại hoặc để máy ảo (VM) quá trình ứng dụng của bạn. Điều thứ nhất là hoàn hảo cho việc phát hiện chậm các hoạt động được thực hiện trên thread UI, trong khi sau này sẽ giúp bạn phát hiện rò rỉ bộ nhớ và bối cảnh.
để sử dụng chế độ nghiêm ngặt, tạo ra một lớp ThreadPolicy mới và một lớp VmPolicy mới, sử dụng các lớp học xây dựng tĩnh của họ với các phát hiện phương pháp * để xác định các hành động giám sát. Các hình phạt tương ứng * phương pháp kiểm soát cách hệ thống nên phản ứng để phát hiện những hành động.
Các chính sách chủ đề có thể được sử dụng để phát hiện đĩa đọc / ghi và truy cập mạng, trong khi chính sách Vm có thể giám sát ứng dụng của bạn để hoạt động, SQLite, và rò rỉ đối tượng closeable.
các hình phạt dành cho cả hai chính sách bao gồm khai thác gỗ hoặc tử vong ứng dụng, trong khi các chính sách đề cũng hỗ trợ hiển thị một hộp thoại trên màn hình hoặc nhấp nháy màn hình biên giới.
cả hai lớp người xây dựng cũng bao gồm một phương pháp detectAll bao gồm tất cả các tùy chọn theo dõi có thể được hỗ trợ bởi nền tảng máy chủ. Bạn cũng có thể sử dụng phương pháp strictMode.enableDefaults áp dụng giám sát mặc định và lựa chọn hình phạt.
Để kích hoạt chế độ nghiêm ngặt trên toàn bộ ứng dụng của bạn, bạn nên mở rộng các lớp ứng dụng, như trong Liệt kê 18-19.
đang được dịch, vui lòng đợi..
 
Các ngôn ngữ khác
Hỗ trợ công cụ dịch thuật: Albania, Amharic, Anh, Armenia, Azerbaijan, Ba Lan, Ba Tư, Bantu, Basque, Belarus, Bengal, Bosnia, Bulgaria, Bồ Đào Nha, Catalan, Cebuano, Chichewa, Corsi, Creole (Haiti), Croatia, Do Thái, Estonia, Filipino, Frisia, Gael Scotland, Galicia, George, Gujarat, Hausa, Hawaii, Hindi, Hmong, Hungary, Hy Lạp, Hà Lan, Hà Lan (Nam Phi), Hàn, Iceland, Igbo, Ireland, Java, Kannada, Kazakh, Khmer, Kinyarwanda, Klingon, Kurd, Kyrgyz, Latinh, Latvia, Litva, Luxembourg, Lào, Macedonia, Malagasy, Malayalam, Malta, Maori, Marathi, Myanmar, Mã Lai, Mông Cổ, Na Uy, Nepal, Nga, Nhật, Odia (Oriya), Pashto, Pháp, Phát hiện ngôn ngữ, Phần Lan, Punjab, Quốc tế ngữ, Rumani, Samoa, Serbia, Sesotho, Shona, Sindhi, Sinhala, Slovak, Slovenia, Somali, Sunda, Swahili, Séc, Tajik, Tamil, Tatar, Telugu, Thái, Thổ Nhĩ Kỳ, Thụy Điển, Tiếng Indonesia, Tiếng Ý, Trung, Trung (Phồn thể), Turkmen, Tây Ban Nha, Ukraina, Urdu, Uyghur, Uzbek, Việt, Xứ Wales, Yiddish, Yoruba, Zulu, Đan Mạch, Đức, Ả Rập, dịch ngôn ngữ.

Copyright ©2024 I Love Translation. All reserved.

E-mail: