【问题标题】:Android RadioButtons Appearing Too LightAndroid RadioButtons 显得太轻了
【发布时间】:2016-09-15 14:26:20
【问题描述】:

我创建了一个投票应用程序,发现我的 RadioButton 非常轻,我几乎看不到与 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);
    }
}

【问题讨论】:

  • 我发现一些图标也一样...直到现在不知道如何继续。为您的任务加一个。

标签: java android radio-button


【解决方案1】:

您将不得不使用自定义单选按钮或考虑更改活动的背景。

检查这两个主题:

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

Adding custom radio buttons in android

【讨论】:

  • 你知道为什么它看起来很轻吗?我只是想让它变暗/加粗,我不确定为什么它首先看起来很亮......
猜你喜欢
  • 1970-01-01
  • 2013-02-01
  • 1970-01-01
  • 2017-05-02
  • 1970-01-01
  • 2022-01-12
  • 2012-05-17
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多