Calculate image size when using setCompoundDrawables for EditText
Drawable dr = this.getResources().getDrawable(R.drawable.warning);//获得图片资源路径
Bitmap bitmap = ((BitmapDrawable) dr).getBitmap();//
Drawable d = new BitmapDrawable(this.getResources(), Bitmap.createScaledBitmap(bitmap, 35, 35, true));
txtValue.setCompoundDrawablesWithIntrinsicBounds(d, null, null, null);
网友评论