How to change color of Items in AlertDialog.Builder AppCompat ?
I want to set textColor of items(photo,gallary) to any other.
here is my code:
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.AppCompatAlertDialogStyle);
builder.setTitle(getResources().getString(R.string.choose_image_source));
builder.setItems(new CharSequence[]{getResources()
.getString(R.string.photo), getResources()
.getString(R.string.camera)}, new DialogInterface.OnClickListener() {
...
<style name="AppCompatAlertDialogStyle" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="colorAccent">#000000</item><!-- buttons OK cancel-->
<item name="android:textColorPrimary">#696969</item><!--text in message-->
<item name="android:background">#f0a400</item> <!-- all bg-->
</style>
<style name="MyTitleTextStyle">
<item name="android:textColor">#000000</item><!-- title color-->
<item name="android:textAppearance">@style/TextAppearance.AppCompat.Title</item>
</style>
Try this:
<style name="AppCompatAlertDialogStyle" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="colorAccent">#000000</item><!-- buttons OK cancel-->
<item name="android:textColorPrimary">#696969</item><!--text in message-->
<item name="android:background">#f0a400</item> <!-- all bg-->
<!-- items color -->
<item name="textColorAlertDialogListItem">#33b5e5</item>
</style>
<style name="MyTitleTextStyle">
<item name="android:textColor">#000000</item><!-- title color-->
<item name="android:textAppearance">@style/TextAppearance.AppCompat.Title</item>
</style>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With