For example, display an image in EditText.
The principle is to use ImageView to implement the relative layout (RelativeLayout ).
The Code is as follows:
<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>
Here is just a local code. If some other custom styles or references are not written, you just need to know the key points. The most important thing in the above Code is:
Android: layout_alignLeft = "@ + id/edt_operator_name" www.2cto.com
Android: layout_alignTop = "@ + id/edt_operator_name"
Android: layout_alignBottom = "@ + id/edt_operator_name" android: src = "@ drawable/sync_operator"
The meaning of these statements is to align the left, top, and top of syncOperatorImag with edt_operator_name.
Note: It must be based on RelativeLayout, otherwise it will not work.
From: cangkukuaimanle's column