将位图设置为drawableLeft到EditText

时间:2014-05-09 15:12:54

标签: android android-edittext

我正在开发一个应用程序,它从联系人数据库中检索联系人图像,并将其设置为EditText作为drawableLeft以及联系人姓名

我能够检索名称以及联系人图像作为位图,但无法将其设置为drawableLeft

2 个答案:

答案 0 :(得分:7)

试试这段代码:

BitmapDrawable drawableLeft = new BitmapDrawable(getResources(), yourBitmap);
mYourEditText.setCompoundDrawablesWithIntrinsicBounds(drawableLeft, null, null, null);

答案 1 :(得分:1)

而不是在textview上设置位图使用ImageView

相关问题