Android 开发关于Button或TextView控件英文字符全部显示大小写问题
2016-08-05 15:44
906 查看
转载请注明来源: http://blog.csdn.net/kjunchen/article/details/52129797
其布局代码为:
可以看到在布局代码中有明显的大小写,但是Button控件显示的却全是大写。其原因是在新的 API 中 Button 的 textAllCaps 属性被设置为 true 导致的,接下来将其设置为 false 在看看效果:
布局代码:
其显示结果为:
可以看到 TextView 的 textAllCaps 属性设置为 true 后,无论设置的文本是大写还是小写,显示全部为大写, Button 的 textAllCaps 设置为 false 后,则根据设置的文本进行显示。
textAllCaps 属性是控制文本是否全部显示为大写。
欢迎加QQ群交流: 365532949
Homepage: http://junkchen.com
Android 开发关于Button或TextView控件英文字符全部显示大小写问题
在较新的 sdk 版本中,开发中我们会看到按钮的英文显示全为大写的。像下面这样:其布局代码为:
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" /> <Button android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Button"/>
可以看到在布局代码中有明显的大小写,但是Button控件显示的却全是大写。其原因是在新的 API 中 Button 的 textAllCaps 属性被设置为 true 导致的,接下来将其设置为 false 在看看效果:
布局代码:
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAllCaps="true" android:text="Hello World!" /> <Button android:layout_width="match_parent" android:layout_height="wrap_content" android:textAllCaps="false" android:text="Button"/>
其显示结果为:
可以看到 TextView 的 textAllCaps 属性设置为 true 后,无论设置的文本是大写还是小写,显示全部为大写, Button 的 textAllCaps 设置为 false 后,则根据设置的文本进行显示。
textAllCaps 属性是控制文本是否全部显示为大写。
欢迎加QQ群交流: 365532949
Homepage: http://junkchen.com
相关文章推荐
- Android中帧布局FrameLayout 霓虹灯效果 color数组报错问题
- Android Studio 通过JNA调用 Clang编译的so库,以及Java JNA 调用x64dll,C# dllimport调用x86dll
- Android之Dialog
- OrmLite的封装
- Android总结篇系列:Android广播机制
- android6.0蓝牙配对加入提示音
- android -详谈Style和Theme
- Android Fragment
- RxJava Android(RxAndroid) 开发全家桶
- 编译Android内核模块
- 设计模式之状态模式---State Pattern
- Android Retrofit RxJava实现缓存
- Monkey测试简介[附示例]
- Android BLE蓝牙4.0开发详解
- bindService失败的解决办法
- 第三方集成的坑如:java.util.zip.ZipException: duplicate entry: com/ta/utdid2/android/utils/AESUtils.class
- Android学习笔记之AndroidManifest.xml文件解析
- Android控件EditText中文本光标位置的设置
- Android和PHP开发最佳实践
- 【Android】【优化】