I have a alertdialog which contains multichoice items and all other functionality is working fine. I've a problem with the color of the checkbox it is showing is not matching with my app color. I've tried with the setcustombuilder but it is not working. Please help. I dont want to use listview.
final String[] ratings = {"2015","2016"};
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
final boolean[] ratingschecked = {false,false};
builder.setTitle("Select Year");
builder.setMultiChoiceItems(ratings, ratingschecked, new DialogInterface.OnMultiChoiceClickListener() {
@Override
public void onClick(DialogInterface dialog, int which, boolean isChecked) {
//something
}
}).setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//something
}
}).setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
AlertDialog dialog = builder.create();
builder.show();
is there any possibilties to change the color of android checkbox color to other?
Created a Style file.
<style name="AppCompatAlertDialogStyle" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="colorAccent">@color/brand</item>
</style>
Then add this file in the App theme. It works.
<item name="alertDialogTheme">@style/AppCompatAlertDialogStyle</item>
Use this line in your theme in styles.xml
<style>
<item name="android:colorAccent">@android:color/holo_green_dark</item>
</style>
with color of your choice