我在整个应用程序中使用色彩渲染图标。
例如,在我的 ImageView
中:
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:src="@drawable/ic_account_circle"
android:tint="@color/red_color"/>
我还使用了一些EditText
中的图标作为它的可绘制内容:
<EditText
android:id="@+id/passwordInput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/ic_lock"
android:drawablePadding="@dimen/medium_margin_padding"
android:hint="@string/password_text"
android:inputType="textPassword" />
然而,我找不到可以用于在EditText
中给可绘制对象着色的代码。这是不可能的吗?
注意:
我使用了 appcompat 和 design support library,但仍然找不到任何代码。
PorterDuff.Mode
更改为SRC_IN
。 - cinfwatd