如何在 API 21 中获取复选框的 ButtonDrawable?

How to get ButtonDrawable of a checkbox in API 21?

我在复选框的 android:button 属性中设置了一个矢量可绘制对象:

<androidx.appcompat.widget.AppCompatCheckBox
    ...
    android:button="@drawable/avd_urgent"
    ...
/>

现在我想在我的代码中获取这个可绘制对象并为其设置动画:

urgentChbx.setOnCheckedChangeListener((view, isChecked) -> {
    ((Animatable) urgentChbx.getButtonDrawable()).start(); // available only in API 23 and above
}

但是 getButtonDrawable() 方法只能在 API 23 级及以上才能使用。如何在 API 级别 21 中获得可绘制的按钮?

正如 Mike M. 在评论中提到的,使用 CompoundButtonCompat.getButtonDrawable(urgentChbx) 获取复选框的可绘制按钮。