How to change border color of radio button in android? [duplicate]

て烟熏妆下的殇ゞ 提交于 2019-11-27 18:49:38

问题


This question already has an answer here:

  • Change Circle color of radio button 18 answers

How to change border color of radio button in android?

I want to change circle color of android radio button.

Thanks in advance. Any help is greatly appreciated.

I have try different soluation and concern if any property is there other that drawable image


回答1:


The easiest way to customize(change color) your views.

Goto : http://android-holo-colors.com/

  • Select the color you want for Radio Button
  • Download Output Resources (Download.Zip)
  • Extract zip contents
  • Copy files from extracted zip to your project drawables, styles and values
  • Change the parent of your app theme to the one you downloaded
  • And you have got what you wanted



回答2:


Yes, this is the property you are looking for: buttonTint, but only works on api level 21 or above

<RadioButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/radio"
    android:checked="true"
    android:buttonTint="@color/your_color"/>

in your values/colors.xml put your color in this case a reddish one:

<color name="your_color">#e75748</color>

Result:




回答3:


Try using AppCompatRadioButton

<android.support.v7.widget.AppCompatRadioButton
    android:id="@+id/rb"
    app:buttonTint="@color/colorAccent" //This to set your default button color
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>

For more detail check this answer : Android: Change the color of RadioButtons and checkboxes programmatically




回答4:


I think you are trying to customize the built-in radio button. try this link. This is your solution. Full n final. Click here.



来源:https://stackoverflow.com/questions/16213186/how-to-change-border-color-of-radio-button-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!