EditText 用代码的方式修改图标
setCompoundDrawablesWithIntrinsicBounds(Drawable left, Drawable top, Drawable right, Drawable bottom)
setCompoundDrawablesWithIntrinsicBounds(null,null, getResources().getDrawable(R.drawable.delete),null);
package com.example.edtitextview_2014_10_15;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.EditText;
/****
* 自定义 edittext
* @author Patrick
*
*/
public class EdtitextView extends EditText {
public Context context;
public EdtitextView(Context context) {
super(context);
this.context = context;
init();
}
public EdtitextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
this.context = context;
init();
}
public EdtitextView(Context context, AttributeSet attrs) {
super(context, attrs);
this.context = context;
init();
}
private void init() {
//setCompoundDrawablesWithIntrinsicBounds(Drawable left, Drawable top, Drawable right, Drawable bottom)
setCompoundDrawablesWithIntrinsicBounds(null,null, getResources().getDrawable(R.drawable.delete),null);
}
}