美文网首页
Android Button#setText 不区分大小写问题

Android Button#setText 不区分大小写问题

作者: AlanFu | 来源:发表于2018-05-22 16:59 被阅读0次
问题描述:

在给Button设置文本内容的时候,字母莫名奇妙的统统变成了大写,如代码为setText(“sheep”),显示为SHEEP。

解决方法:
在xml中button节点加入android:textAllCaps=”false” 
或者 
button.setAllCaps(false);
再或者
button.setTransformationMethod(null);
产生原因:

Sets the properties of this field to transform input to ALL CAPS
display. This may use a "small caps" formatting if available.
This setting will be ignored if this field is editable or selectable.
This call replaces the current transformation method. Disabling this
will not necessarily restore the previous behavior from before this
was enabled.

参考文章:

https://blog.csdn.net/baidu_30889437/article/details/51956563
https://www.aliyun.com/jiaocheng/42095.html

相关文章

网友评论

      本文标题:Android Button#setText 不区分大小写问题

      本文链接:https://www.haomeiwen.com/subject/rqhkjftx.html