Button英文字符自动大写的问题
2016-05-31 00:56
344 查看
问题
如题原因分析
以我项目中使用Theme.AppCompat.Light.DarkActionBar主题为例。跟踪源码可发现,该主题中有:<style name="Base.TextAppearance.AppCompat.Button"> <item name="android:textSize">@dimen/abc_text_size_button_material</item> <item name="textAllCaps">true</item> <item name="android:textColor">?android:textColorPrimary</item> </style>
关键的原因在于:
<item name="textAllCaps">true</item>
当然,如果细看的话,会发现不止是Button这一控件的该属性被设置成了true。
解决方法
由上面的原因分析便可简单的找到解决方法,这里简单提及两种方式:修改style.xml如:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <!-- Customize your theme here. --> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> <item name="textAllCaps">false</item> </style>
将textAllCaps属性设置为false。如此,整个项目中的相关控件的(字符)文本都可避免被自动转换为大写。
2. 在具体控件中重置该属性为false,如:
<Button android:id="@+id/btn_answer1" android:layout_width="match_parent" android:layout_height="wrap_content" android:textAllCaps="false" />
这方法唯一不足的是需要对每个相关控件都设置该属性。
相关文章推荐
- android Studio将String.xml中的字段导出。
- jquery ajax监听 then when done
- HashMap为什么是线程不安全的
- Alfred 爬坑
- iptables (1) 原理
- SwipeRefreshLayout 源码分析
- Python基础(七)内置函数
- iOS原生Http请求,get post 异步
- 《图解TCP/IP》读书笔记(4)
- 解决Delphi的TAnimate控件的Common AVI在Vista以后版本中不能正常工作的问题
- 安装配置Jpcap,使用jpcap抓包
- VS C# ADO.NET代码连接Access数据库
- Surface, SurfaceView和SurfaceHolder
- 【Leetcode】 Clone Graph
- 5.31
- android studio如何修改包名
- rabbitmq 对多服务器p2p模式配置的一个测试
- 【Leetcode】Permutation Sequence
- Archlinux MySQL PHP phpmyadmin Apache PHP-Apache Install
- linux 解决man命令输出到文档打开乱码问题