Sử dụng từ xa xem để Thêm Widget tương tác
App Widgets kế thừa quyền truy cập của các quy trình trong đó họ chạy, và hầu hết các ứng dụng màn hình chủ chạy với quyền đầy đủ, làm cho rủi ro an ninh tiềm năng đáng kể. Như một kết quả của những tác động an ninh, Widget tương tác được kiểm soát cẩn thận.
Tương tác Widget thường được giới hạn như sau:
Thêm một lý nhấp chuột vào một hoặc nhiều lần xem
► Thay đổi giao diện người dùng dựa trên những thay đổi lựa chọn Chuyển giữa xem trong vòng một Bộ sưu tập Xem Widget (¿ yi không có kỹ thuật hỗ trợ cho việc nhập văn bản trực tiếp vào một widget ứng dụng. Nếu bạn cần nhập văn bản từ widget của bạn, tốt nhất là thêm một lý nhấp chuột vào widget hiển thị một Hoạt động chấp nhận đầu vào. Sử dụng một lý nhấp chuột đơn giản nhất và cách mạnh mẽ nhất để thêm các tương tác vào widget của bạn bằng cách thêm một lý nhấp chuột để xem nó. Điều này được thực hiện bằng cách sử dụng phương pháp setOnClickPendingIntent trên một đối tượng xem từ xa. sử dụng phương pháp này để xác định một ý định chờ sẽ được kích hoạt khi người dùng nhấp chuột định Xem, như thể hiện trong Liệt kê 14-11.
đang được dịch, vui lòng đợi..