简体   繁体   中英

Want hint and text to have different layouts

我有一个textview,我希望此textview的提示应该居中,但是用户输入的文本是从左到右,这可能吗?

You could set TextWatcher to your edittext and change gravity corresponding to its contains. So if there is no any char and thus hint will be displayed - make gravity center and with the 1st entered char make gravity left.

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