gpt4 book ai didi

android - Appcompact DialogFragment单选复选标记颜色

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:43:17 25 4
gpt4 key购买 nike

我有一个问题。我的 Activity 有风格

<style name="MaterialTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/action_bar_background</item>
<item name="colorPrimaryDark">@color/action_bar_background</item>
<item name="colorAccent">@color/action_bar_background</item>
</style>

我还有带有简单单选选择器的 dialogFragment。

@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
final AlertDialog.Builder dialog = new AlertDialog.Builder(getActivity());
dialog.setTitle(R.string.image_resolution);
dialog.setSingleChoiceItems(R.array.quality_labels, getPosition(), this);
return dialog.create();
}

如何更改选择器复选标记的颜色(绿色圆圈)??? enter image description here

最佳答案

您必须为AlertDialog创建相应的样式

<style name="MaterialThemeDialog" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="colorAccent">@color/action_bar_background</item>
</style>

并将其传递给AlertDialog.Builder构造函数

@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
final AlertDialog.Builder dialog = new AlertDialog.Builder(
getActivity(),
R.style.MaterialThemeDialog);
dialog.setTitle(R.string.image_resolution);
dialog.setSingleChoiceItems(R.array.quality_labels, getPosition(), this);
return dialog.create();
}

关于android - Appcompact DialogFragment单选复选标记颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28840700/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com