Tinting Checkbox on pre v21

前端 未结 5 1168
春和景丽
春和景丽 2020-12-09 15:59

So, I want to apply tint to AppCompat Checkbox.

Everything works fine on Lollipop:

android:buttonTint=\"@color/purple_FF4081\"

or t

5条回答
  •  情话喂你
    2020-12-09 16:33

    EDIT 6/28/16: The below answer is no longer correct. See the accepted answer on the new way Google has allowed tinting on pre-v21 devices with the appcompat library.


    Original Answer:

    The short answer is: no. Custom drawables will need to be created for use on pre-v21 devices. This is because the special tint aware widgets are currently hidden because they're an unfinished implementation detail at this time (which Google states that this may change in the future, according to their developer blog in the FAQ section)

    There are two scenarios you could override the colorAccent that may work:

    • Have your own custom version of the widget (i.e. you’ve extended EditText)
    • Creating the EditText without a LayoutInflater (i.e., calling new EditText()).

提交回复
热议问题