2016-06-10 2 views
0

AlertDialog에서 다른 체크 표시가 있습니다! Lollypop! 그리고 나는 그것을 제거하고 자신을 떠나야합니다. 프롬프트, 누가 직면 할 수 있습니까?AlertDialog에서 첫 번째 확인 표시를 제거하는 방법. 다중 선택

enter image description here

에 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> 

답변

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> 

나는이 생각을 테스트하지 않았습니다. 행운을 빕니다!