在某处出现的AlertDialog中还有另一个checkMark Lollypop!我需要删除它并留下你自己的。提示,谁可以面对?
AlertDialog:
mSurchargeBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
boolean[] checkedItems = new boolean[surchargeListNames.length];
int count = surchargeListNames.length;
for (int i = 0; i < count; i++)
checkedItems[i] = selectedSurchargeItems.contains(surchargeListNames[i]);
AlertDialog.Builder builder = new AlertDialog.Builder(DetailsActivity.this, R.style.AlertDialogCustom);
builder.setMultiChoiceItems(surchargeListNames, checkedItems, new DialogInterface.OnMultiChoiceClickListener() {
@Override
public void onClick(DialogInterface dialog, int which, boolean isChecked) {
if (isChecked)
selectedSurchargeItems.add(surchargeListNames[which]);
else
selectedSurchargeItems.remove(surchargeListNames[which]);
}
});
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
AlertDialog dialog = builder.create();
dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
dialog.show();
}
样式:
<style name="AlertDialogCustom" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="android:checkMark">?android:attr/textCheckMark</item>
</style>
答案 0 :(得分:1)
您可以定义一个展开Widget.AppCompat.CompoundButton.CheckBox
例如
<style name="mycheckbox" parent="Widget.AppCompat.CompoundButton.CheckBox">
<item name="android:button">@null</item>
</style>
并以您的主要风格
<style name="AlertDialogCustom" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="android:checkMark">?android:attr/textCheckMark</item>
<item name="android:checkboxStyle">@style/mycheckbox</item>
</style>
我还没有测试过这个。祝你好运!