Changing RadioButton color on API 19 and below?
Asked Answered
P

1

3

So I have an app in which the user can select a color by choosing from a set of RadioButtons, I have used the ButtonTint XML attribute to color the buttons, but obviously this only works on API > 21/.

so my question is,

how to change the color of the RadioButtons on KitKat(API 19) and below?

I have tested a few methods from other stack overflow questions, but so far none have worked.

Proulx answered 8/3, 2016 at 12:19 Comment(0)
D
6

Use design support library (23.2.0 OR latest) and appcompatwidgets as below

Material Design for Pre-Lollipop Devices :

AppCompat (aka ActionBarCompat) started out as a backport of the Android 4.0 ActionBar API for devices running on Gingerbread, providing a common API layer on top of the backported implementation and the framework implementation. AppCompat v21 delivers an API and feature-set that is up-to-date with Android 5.0


Android Support Library 22.1 :

The ability to tint widgets automatically when using AppCompat is incredibly helpful in keeping strong branding and consistency throughout your app. This is done automatically when inflating layouts - replacing Button with AppCompatButton, TextView with AppCompatTextView, etc. to ensure that each could support tinting. In this release, those tint aware widgets are now publicly available, allowing you to keep tinting support even if you need to subclass one of the supported widgets.

This tint aware widgets are now publicly available, allowing you to keep tinting support even if you need to subclass one of the supported widgets.

From link above,

The full list of tint aware widgets at this time is:

AppCompatAutoCompleteTextView
AppCompatButton
AppCompatCheckBox
AppCompatCheckedTextView
AppCompatEditText
AppCompatMultiAutoCompleteTextView
AppCompatRadioButton
AppCompatRatingBar
AppCompatSpinner
AppCompatTextView
Devereux answered 8/3, 2016 at 12:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.