如何将图像放在EditText字段中?

时间:2013-03-13 18:27:46

标签: android android-layout android-edittext

我想将图像放在EditText字段中,如图所示。应该怎么做呢?分层列表,在一层上有图像,在另一层的EditText左侧有很多填充?

enter image description here

2 个答案:

答案 0 :(得分:8)

在editText中设置图像。

<EditText
   ......  
    android:drawableLeft="@drawable/image" />

您可以将其设置为左,右,上,下。

答案 1 :(得分:1)

只需使用

即可
setCompoundDrawables(Drawable left, Drawable top, Drawable right, Drawable bottom)

setCompoundDrawablesWithIntrinsicBounds(Drawable left, Drawable top, Drawable right, Drawable bottom)

方法

干杯