EditText利用代码设置左侧的图标,失效???

EditText有两种设置图标的方法:


1、setCompoundDrawables(left, top, right, bottom)

这个方法,必须设置宽高使,用之前必须使用Drawable.setBounds设置Drawable的长宽。


2、setCompoundDrawablesWithIntrinsicBounds(left, top, right, bottom)

这个方法,是照drawable的宽高画的图片。


所以在代码里面,使用setCompoundDrawablesWithIntrinsicBounds就会显示出来图片。

猜你喜欢

转载自blog.csdn.net/android_glimmer/article/details/78124821
今日推荐