1

I am using the MaterialDialog library to create some custom dialogs and the docs are found here:

https://github.com/afollestad/material-dialogs

Yet, I can't color the squared boxes of the unchecked checkboxes. The problem is that my background is white, and the dialog by default is making the unchecked boxes white too. So it disappears like below:

enter image description here

I was looking at the docs, but I don't understand the ".widgetColorAttr()" and ".widgetColorRes()" which might do that I need.

here's what I tried:

<!-- resources -->
<color name="WhiteColor">#fff</color>
<color name="CyanColor">#009688</color>
etc...
<!-- code -->
final int widgetColor = ContextCompat.getColor(activity, R.color.CyanColor);
        new MaterialDialog.Builder(activity)
                .widgetColor(widgetColor)
                .backgroundColor(backGroundColor)
        etc...

thank you!

gmmo
  • 2,577
  • 3
  • 30
  • 56

1 Answers1

0

Short answer:

int id = Resources.getSystem().getIdentifier("btn_check_holo_light", "drawable", "android");
checkBox.setButtonDrawable(id);

Detailed answer.

Community
  • 1
  • 1
Harsh Pandey
  • 831
  • 7
  • 12