简体   繁体   中英

Android Custom EditText text alignment bottom

I created a custom drawable for the background of an EditText. I need the text to be left and bottom aligned. It renders fine on screen but the text is not aligned to the right nor the bottom of the drawable. I also tried gravity:bottom and tried setting the padding on top in hopes it would move it down. Is there anything else I can do?

在此处输入图片说明

The right and bottom lines define the content area.

The line you draw on the right spans the top half of your image. That's why the text won't align to the bottom.

You should draw a slightly longer line.

Check out the image used by default. (I changed it to blue here though).

在此处输入图片说明

This will give the same result you are having. The text won't be aligned to the bottom.

Now if I extend the right line to the bottom, I would obtain the below image.

在此处输入图片说明

This will give you the expected result.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM