android– 如何在AlertDialog.Builder AppCompat中更改Items的颜色?

android– 如何在AlertDialog.Builder AppCompat中更改Items的颜色?,第1张

概述如何在AlertDialog.BuilderAppCompat中更改Items的颜色?我想将textColor项目(照片,gallary)设置为其他任何项目.这是我的代码:AlertDialog.Builderbuilder=newAlertDialog.Builder(getActivity(),R.style.AppCompatAlertDialogStyle);builder.setTitle(getResourc

如何在AlertDialog.Builder AppCompat中更改Items的颜色?

我想将textcolor项目(照片,gallary)设置为其他任何项目.

这是我的代码:

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>

解决方法:

试试这个:

<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>
总结

以上是内存溢出为你收集整理的android – 如何在AlertDialog.Builder AppCompat中更改Items的颜色?全部内容,希望文章能够帮你解决android – 如何在AlertDialog.Builder AppCompat中更改Items的颜色?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1107923.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-29
下一篇2022-05-29

发表评论

登录后才能评论

评论列表(0条)

    保存