Tôi đã sử dụng AlertDialog để cảnh báo người dùng xác nhận xóa. Tôi kiểm tra điện thoại của tôi (Android 5.1) và nó hiển thị tốtHộp thoại không hiển thị nút tích cực và tiêu cực
Nhưng trên một số thiết bị khác (cũng chạy Android 5.1), hộp thoại nhỡ nút tích cực và tiêu cực.
tôi đã kiểm tra và phát hiện ra rằng các thiết bị xảy ra vấn đề này có độ phân giải trung bình (960x540, 854x480).
Độ phân giải có liên quan đến vấn đề này không? Nếu không, bạn có thể cho tôi biết lý do và cách khắc phục sự cố này không?
Mã của tôi cho hộp thoại hiển thị:
public static final Dialog yesNoDialog(Context context,
String message,
DialogInterface.OnClickListener yesAction, DialogInterface.OnClickListener noAction) {
AlertDialog.Builder builder = new AlertDialog.Builder(context,R.style.todoDialogLight);
builder.setTitle(context.getString(R.string.app_name))
.setMessage(message)
.setCancelable(false)
.setPositiveButton("YES", yesAction)
.setNegativeButton("NO", noAction);
return builder.create();
}
Và styles.xml
<style name="todoDialogLight" parent="Theme.AppCompat.Light.Dialog">
<!-- Used for the buttons -->
<item name="colorAccent">@color/colorPrimaryDark</item>
<item name="android:textStyle">bold</item>
<!-- Used for the title and text -->
<item name="android:textColorPrimary">@color/colorText</item>
<!-- Used for the background -->
<!-- <item name="android:background">#4CAF50</item>-->
<item name="android:fontFamily">sans-serif</item>
<item name="android:windowAnimationStyle">@style/RemindDialogAnimation</item>
<item name="android:layout_width">@dimen/width_remind_dialog</item>
<item name="android:layout_height">wrap_content</item>
</style>
là gì tất cả điều này? PreferenceUtil ở đâu? các kiểu "todoDialogLight" và "todoDialogDark" ở đâu? xin vui lòng cải thiện câu trả lời của bạn – usman