5

I'd like to put an image in an EditText field, as shown. How should one go about this? Layered-list with the image on one layer and a lot of padding on the left side of the EditText on the other layer?

enter image description here

4

2 回答 2

8

在editText中设置图像。

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

您可以设置它左,右,上,下。

于 2013-03-13T18:30:43.707 回答
1

只需使用

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

或者

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

方法。

干杯

于 2013-03-13T18:30:39.260 回答