
我正在开发一个具有多种形式的应用程序,但我想要一些效果.我想要做的是改变放置在编辑文本中的图标的颜色.
<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); 总结 以上是内存溢出为你收集整理的android – 如何更改放置在edittext中的图标的颜色?全部内容,希望文章能够帮你解决android – 如何更改放置在edittext中的图标的颜色?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)