+ id);// Create a new Remote Views object using the appropriate // ite dịch - + id);// Create a new Remote Views object using the appropriate // ite Việt làm thế nào để nói

+ id);// Create a new Remote Views

+ id);
// Create a new Remote Views object using the appropriate // item layout
RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.my_media_widget_item_layout);
// Assign the values extracted from the Cursor to the Remote Views. rv.setImageViewUri(R.id.widget_media_thumbnail, uri);
// Assign the item-specific fill-in Intent thViews Factory to be executed, followed by the meta-data calls, including getCount, before each of the Views is re-created.
Alternatively, the techniques used to update App Widgets — altering the minimum refresh rate, using Intents, and setting Alarms — can also be used to update Collection View Widgets; however, they will cause the entire Widget to be re-created, meaning that refreshing the collection-based Views based on changes to the underlying data is more efficient.
Creating an Earthquake Collection View Widget
In this example you add a second Widget to the Earthquake application. This one will use a ListView-based Collection View Widget to display a list of the recent earthquakes.
1. Start by creating a layout for the Collection View Widget UI as an XML resource. Save the quake_collection_widget.xml file in the res/layout folder. Use a Frame Layout that includes the List View for displaying the earthquakes and a Text View to display when the collection is empty:
t will populate // the Pending Intent template specified in the App Widget // Provider. In this instance the template Intent specifies // an ACTION_VIEW action.
Intent fillInIntent = new Intent(); fillInIntent.setData(uri);
rv.setOnClickFillInIntent(R.id.widget_media_thumbnail,
fillInIntent);
return rv;
}
public int getViewTypeCount() {
// The number of different view definitions to use.
// For Content Providers, this will almost always be 1. return 1;
}
public boolean hasStableIds() {
// Content Provider IDs should be unique and permanent. return true;
}
public void onDestroy() {
// Close the result Cursor. c.close();
}
public RemoteViews getLoadingView() {
// Use the default loading view. return null;
This more flexible alternative for exposing Content Provider data on the home screen is a replace¬ment for Live Folders, which have now been deprecated.
Refreshing Your Collection View Widgets
The App Widget Manager includes the notifyAppWidgetViewDataChanged method, which allows you to specify a Widget ID (or array of IDs) to update, along with the resource identifier for the col¬lection View within that Widget whose underlying data source has changed:
appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds,
R.id.widget_stack_view);
This will cause the onDataSetChanged handler within the associated Remote
0/5000
Từ: -
Sang: -
Kết quả (Việt) 1: [Sao chép]
Sao chép!
+ id);Tạo một đối tượng từ xa xem mới bằng cách sử dụng thích hợp / / mục bố cụcRemoteViews rv = mới RemoteViews(context.getPackageName(), R.layout.my_media_widget_item_layout);Gán các giá trị được chiết xuất từ con trỏ chuột để xem từ xa. rv.setImageViewUri (R.id.widget_media_thumbnail, uri);Gán điền vào mục cụ thể mục đích thViews nhà máy được thực hiện, theo sau là các cuộc gọi dữ liệu meta, bao gồm cả getCount, trước khi mỗi người trong số các quan điểm được tái tạo.Ngoài ra, các kỹ thuật được sử dụng để cập nhật ứng dụng Widgets — thay đổi tỷ lệ làm tươi tối thiểu, bằng cách sử dụng Intents và thiết lập hệ thống báo động-cũng có thể được sử dụng để Cập Nhật bộ sưu tập xem widget; Tuy nhiên, chúng sẽ gây ra các Widget toàn bộ sẽ được tái tạo, nghĩa là làm mới bộ sưu tập dựa trên quan điểm dựa trên thay đổi đối với các dữ liệu cơ bản là hiệu quả hơn.Việc tạo ra một Widget xem bộ sưu tập trận động đấtTrong ví dụ này bạn thêm một tiện ích thứ hai ứng dụng trận động đất. Điều này sẽ sử dụng một ListView dựa trên bộ sưu tập xem Widget để hiển thị một danh sách các trận động đất tại.1. bắt đầu bằng cách tạo ra một bố trí cho giao diện người dùng tiện ích xem của bộ sưu tập như là một nguồn XML. Lưu tệp quake_collection_widget.xml trong thư mục res/layout. Sử dụng một cách bố trí khung bao gồm các danh sách để hiển thị các trận động đất và xem văn bản để hiển thị khi bộ sưu tập có sản phẩm nào:t sẽ cư / / mẫu đang chờ giải quyết mục đích được chỉ rõ trong các Widget ứng dụng / / nhà cung cấp. Trong này ví dụ mẫu mục đích chỉ định / / hành động ACTION_VIEW.Ý định fillInIntent = mới Intent(); fillInIntent.setData(uri);rv.setOnClickFillInIntent (R.id.widget_media_thumbnail,fillInIntent);trở về rv;}khu vực int getViewTypeCount() {}Số lần xem khác nhau định nghĩa để sử dụng.Đối với các nhà cung cấp nội dung, điều này hầu như luôn luôn sẽ là 1. trở về 1;}khu vực boolean hasStableIds() {}ID nhà cung cấp nội dung phải độc đáo và vĩnh viễn. trả lại sự thật;}khu vực void onDestroy() {}Đóng kết quả con trỏ. c.Close();}công RemoteViews getLoadingView() {}Sử dụng mặc định tải xem. trở về null; Này thay thế linh hoạt hơn để lộ dữ liệu cung cấp nội dung trên màn hình là một replace¬ment cho Live Folders, bây giờ bị phản đối.Làm mới các widget xem bộ sưu tập của bạnWidget quản lý ứng dụng bao gồm các phương pháp notifyAppWidgetViewDataChanged, cho phép bạn chỉ định một Widget ID (hoặc mảng ID) để Cập Nhật, cùng với nhận dạng tài nguyên cho col¬lection xem bên trong mà phụ tùng có nguồn dữ liệu bên dưới đã thay đổi:appWidgetManager.notifyAppWidgetViewDataChanged (appWidgetIds,R.ID.widget_stack_view);Điều này sẽ gây ra bộ xử lý onDataSetChanged trong điều khiển từ xa liên kết
đ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: