简体   繁体   中英

How to set the co-ordinate of baseline of edittext in android

I have my co-ordinates of baseline where I want to write my text in android. How to place my text on that baseline co-ordinates. I know how to setX() and setY() functions but they set the X and Y position of top left corner of edit text. I want to write on the baseline, if baseline of co-ordinates are present.

Just adjust your co-ordinates to compensate for the top/left position.

 float adjustedY  = (float) y - myEditText.getMeasuredHeight();
 myEditText.setY(adjustedY);

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