我知道有很多话题讨论之前色调功能SDK 21布局的背景绘制,但 他们要么使用某种imageviews的(我不)或以编程方式解决这个问题(这我不想)。机器人:色彩上SDK <21
我的情况:
我有一个9补丁绘制作为背景的约束布局:
<android.support.constraint.ConstraintLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/testDrawable">
这是我的绘制:
<nine-patch xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/ninepatchdrawable"
android:tint="@color/lightBlue"
android:tintMode="multiply" />
这工作正常更新设备,但正如我所说的色调是不工作的设备sdk < 21.我也没有得到任何形式的错误信息。
我已经尝试过改变我的布局:
<android.support.constraint.ConstraintLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/testDrawable"
android:backgroundTint="@color/lightBlue"
android:backgroundTintMode="multiply">
或使用应用程序:backgroundTint作为另一个问题suggestet。
在此先感谢
看到使用'DrawableCompat#setTint(可绘制绘制,诠释色彩)' – pskink