我正在开发一个具有多种形式的应用程序,但我想要一些效果.我想要做的是改变放置在编辑文本中的图标的颜色.
<EditText
android:id="@+id/marks"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignEnd="@+id/button1"
android:layout_alignParentTop="true"
android:layout_marginTop="10dp"
android:drawableRight="@drawable/ic_border"
android:hint="Total Marks"
android:inputType="number"
android:textColor="#fff" />
最佳答案 如果你想改变颜色,你可以使用它
首先改变drawable的颜色.
Drawable mDrawable = context.getResources().getDrawable(R.drawable.yourdrawable);
mDrawable.setColorFilter(new
PorterDuffColorFilter(0xffff00,PorterDuff.Mode.MULTIPLY));
现在将其设置为EditText
edtText.setCompoundDrawablesWithIntrinsicBounds(mDrawable, 0, 0, 0);