我正在尝试在对话框中添加一个复选框,但我无法执行此操作。它没有显示出来。这是我的代码:
private void checkAnimationSettings() {
try {
ContentResolver cr = activity.getContentResolver();
float animationDurationScale =
Settings.Global.getFloat(cr, Settings.Global.ANIMATOR_DURATION_SCALE);
float windowsAnimationScale =
Settings.Global.getFloat(cr, Settings.Global.WINDOW_ANIMATION_SCALE);
float transitionAnimationScale =
Settings.Global.getFloat(cr, Settings.Global.TRANSITION_ANIMATION_SCALE);
if (animationDurationScale == 0.0f
|| windowsAnimationScale == 0.0f
|| transitionAnimationScale == 0.0f) {
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
boolean newerShowAnimationsOffWarning = sp.getBoolean("newerShowAnimationsOffWarning", false);
if (newerShowAnimationsOffWarning) return;
CharSequence[] items = new CharSequence[]{"Bir daha gösterme"};
Builder builder = new Builder(mainActivity);
builder.setTitle(activity.getString(R.string.animation_settings_warning_title_text));
builder.setMessage(activity.getString(R.string.animation_settings_warning_text));
builder.setMultiChoiceItems(items, null, this);
builder.setPositiveButton("Tamam", null);
builder.create().show();
}
} catch (Settings.SettingNotFoundException e) {
e.printStackTrace();
}
}
这里有什么问题?
提前致谢。
答案 0 :(得分:1)
根据answer
我不知道为什么但是setMessage和setMultiChoiceItems无法正常工作 一起。当我删除setMessage时,列表显示正常。
设置消息和项目列表将不起作用。
对于AlertDialog,您可以保留邮件或项目列表。