Android开发:如何在EditText中设置固定图片
如下图,在EditText中显示图片
其原理就是在相对布局(RelativeLayout)的基础上用ImageView实现
代码如下:
- <RelativeLayout>
- <EditText Android:id="@+id/edt_operator_name" style="@style/syncEditText"
- android:hint="@string/hint_operator_name" />
- <ImageView android:id="@+id/syncOperatorImg" style="@style/syncImageView"
- android:layout_alignLeft="@+id/edt_operator_name"
- android:layout_alignTop="@+id/edt_operator_name"
- android:layout_alignBottom="@+id/edt_operator_name" android:src="@drawable/sync_operator" />
- </RelativeLayout>
- android:layout_alignLeft="@+id/edt_operator_name"
- android:layout_alignTop="@+id/edt_operator_name"
- android:layout_alignBottom="@+id/edt_operator_name" android:src="@drawable/sync_operator"
注意:一定是在RelativeLayout的基础上,否则不行。
相关推荐
Nostalgiachild 2020-11-13
韩伟佳 2020-10-09
wuleihenbang 2020-09-16
zzqLivecn 2020-07-09
chenjinlong 2020-06-10
yinbaoshiguang 2020-06-09
sgafdsg 2020-06-04
ustcrding 2020-06-03
chenjinlong 2020-06-03
AndroidGA 2020-06-01
安辉 2020-05-27
绿豆饼 2020-05-26
CNETNews 2020-05-26
xilove0 2020-05-12
绿豆饼 2020-05-12
ChainDestiny 2020-05-07
doomvsjing 2020-05-07
hqulyc 2020-05-05
lyccsu 2020-04-30