How to Set fixed images in EditText

Source: Internet
Author: User

 

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.