在我的应用“Tide Now WA”中,我最近测试了它的兼容性 新款Nexus 9平板电脑(Lollipop - API 21)。

它写一些按钮文本。这个应用程序使用Android 2.3和Android正确地编写文本 4.0. 即混合大写字母和小写字母。

当同一个应用程序在我的Nexus 9上运行时,所有的字母 正文均大写。

FWIW我的清单包含以下语句:

users -sdk android:minSdkVersion="10" android:targetSdkVersion="14"

我可以在我的代码中修复这个问题,还是操作系统中的一个bug 谢谢


当前回答

在<Button>标签中添加android:textAllCaps="false"。

其他回答

如果你已经到达这里,因为你的facebook按钮文本出现在所有的大写,然后只需添加这个android:textAllCaps="false"在你的xml文件。这对我很管用。

棒棒糖默认带有“textAllCaps true”,所以你必须手动将其设置为false

另一个程序化的Kotlin替代品:

mButton。transformationMethod = null

这在应用程序代码中是可以通过设置按钮的TransformationMethod来修复的。

mButton.setTransformationMethod(null);

使用android.support. widget。XML布局中的AppCompatButton将允许您避免使用layout-21或通过编程更改任何内容。当然,这也将与AppCompat v7库一起工作。

<android.support.v7.widget.AppCompatButton
    android:id="@+id/btnOpenMainDemo"
    android:textAllCaps="false"
    style="@style/HGButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/btn_main_demo"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"/>

希望这能有所帮助。