Android 5.0 (Lollipop) widget button's text are in ALL CAPS [duplicate]

耗尽温柔 提交于 2019-12-13 13:09:22

问题


I have a simple homescreen widget with a few buttons on it. My problem is that when the widgets are running on Lollipop the button's text are all capitalized, any previous Android version doesn't have this problem. The buttons in the layout.xml are very ordinary buttons: no styling or special sauce, just a width height and text size. The interesting thing is that any TextViews I place into the widget aren't affected by this in Lollipop, ie. it appears that only Button objects have this issue.

My AppWidgetProvider is pretty simple too: just sets the sets the text and a PendingIntent for each button.

It sounds like a global styling problem, but I can't find anything in my application's resources that would cause this. Does anyone have any input to this problem? Thanks!


回答1:


You have 2 options :

1.Use android:textAllCaps="false" in your layout-v21 (or anywhere)

  1. Programmatically change the transformation method of the button. mButton.setTransformationMethod(null);


来源:https://stackoverflow.com/questions/27091353/android-5-0-lollipop-widget-buttons-text-are-in-all-caps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!