我创建了一个投票应用程序并注意到我的RadioButtons非常轻,我几乎无法看到与RadioButton相关的圆圈。如果可能的话,我想将RadioButtons(以编程方式)变暗或加粗。
我以编程方式添加我的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);
}
}
答案 0 :(得分:0)
您必须使用自定义单选按钮或考虑更改活动的背景。
检查这两个主题:
Is it possible to change the radio button icon in an android radio button group