gpt4 book ai didi

java - Android RadioButtons 看起来太亮

转载 作者:太空宇宙 更新时间:2023-11-04 12:36:11 26 4
gpt4 key购买 nike

我创建了一个投票应用程序,并注意到我的 RadioButton 非常轻,我几乎看不到与 RadioButton 关联的圆圈。如果可能的话,我想将 RadioButtons 变暗或加粗(以编程方式)。

我以编程方式添加我的单选按钮:

public void addRadioButtonsWithFirebaseAnswers(DataSnapshot dataSnapshot, int numberOfAnswers) {
mPollAnswerArrayList = new ArrayList<RadioButton>();
for (int i = 0; i < numberOfAnswers; i++) {
Log.e("Number of Answers", "The number of answers is " + numberOfAnswers);
mPollAnswerArrayList.add(i, new RadioButton(getActivity().getApplicationContext()));
mPollAnswerArrayList.get(i).setId(i);
String firebaseChild = String.valueOf(i + 1);
mPollAnswerArrayList.get(i).setText(dataSnapshot.child(POLL_ANSWERS_LABEL).child(firebaseChild).child("Answer").getValue().toString());
mPollAnswerArrayList.get(i).setTextColor(getResources().getColor(R.color.black));
mPollAnswerArrayList.get(i).setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.radio_button_answer_text_size));
mParams.setMargins((int) getResources().getDimension(R.dimen.radio_question_margin_left), 0, 0, (int) getResources().getDimension(R.dimen.radio_question_margin_bottom));

mPollQuestionRadioGroup.addView(mPollAnswerArrayList.get(i), mParams);
}
}

enter image description here

最佳答案

您必须使用自定义单选按钮或考虑更改 Activity 的背景。

检查这两个主题:

Is it possible to change the radio button icon in an android radio button group

Adding custom radio buttons in android

关于java - Android RadioButtons 看起来太亮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37310818/

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