Lollipop capitalizes Buttons#39; text in my app(Lollipop 在我的应用程序中将按钮的文本大写)
问题描述
我的应用程序遇到了一个奇怪的问题.当我在真实设备(Android 4.4.4)上测试它时,我所有的按钮文本字段看起来都是我想要的(小写字母).但是当我在模拟器(Android 5.0.1)上启动我的应用程序时,所有按钮文本字段都是大写的.这种行为的原因是什么?我的应用中的一些示例按钮:
I am expreiencing a strange problem with my application. When I am testing it on a real device (with Android 4.4.4) all my Buttons' text fields look how I wanted (lower case letters). But when I launch my application on an emulator (Android 5.0.1) all Button texts fields are capitalized. What is the reason of such behaviour? Some example Buttons from my app:
示例按钮 1:
<Button
android:id="@+id/button5"
android:layout_width="match_parent"
style="?android:attr/borderlessButtonStyle"
android:layout_height="wrap_content"
android:text="@string/finish"
android:textColor="#FFFFFF"
android:textSize="30sp"
/>
示例按钮 2:
<Button
android:id="@+id/button3"
android:layout_width="0dp"
style="?android:attr/borderlessButtonStyle"
android:layout_height="wrap_content"
android:text="@string/flower"
android:textColor="#FFFFFF"
android:textSize="30sp"
android:drawableLeft="@drawable/flower"
android:layout_weight=".75"
/>
这个问题的解决方法是什么.我希望我的应用在所有 sw 版本上看起来都一样.
What is the solution to this problem. I want my app to look the same on all sw versions.
推荐答案
从 Android 5.0 开始,Button
的文本会自动大写.这符合新材料设计指南,您可以找到 这里.
Starting with Android 5.0, Button
s automatically have their text capitalized. This is in accordance with the new material design guidelines, which you can find here.
如果你想强制你的按钮像以前的平台版本一样显示文本,你可以在你的 XML 中设置 android:textAllCaps="false"
.但是,我建议不要这样做.用户希望他们的应用在 Android Lollipop 中看起来很重要,这意味着他们希望您的按钮以全部大写字母显示文本(即使您的应用在以前的平台版本中显示的文本不同).
If you want to force your buttons to display the text as it does in previous platform versions, you can set android:textAllCaps="false"
in your XML. However, I would recommend against this. Users expect their apps to look material in Android Lollipop, and that means they expect your buttons to display text in all capital letters (even if your app displays the text differently in previous platform versions).
这篇关于Lollipop 在我的应用程序中将按钮的文本大写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Lollipop 在我的应用程序中将按钮的文本大写


基础教程推荐
- NSString intValue 不能用于检索电话号码 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01