简体   繁体   English

希望提示和文本具有不同的布局

[英]Want hint and text to have different layouts

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

You could set TextWatcher to your edittext and change gravity corresponding to its contains. 您可以将TextWatcher设置为edittext,并更改其包含的重力。 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. 因此,如果没有任何字符,则将显示提示-使重心居中,并在第一个输入的字符处使重心左移。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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