Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19780] Android: Button title stays uppercased even if the text is in lowercase in the app.js

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionInvalid
Resolution Date2015-10-28T17:32:12.000+0000
Affected Version/sRelease 5.1.0
Fix Version/sn/a
ComponentsAndroid
Labelsqe-5.1.0, regression
ReporterLokesh Choudhary
AssigneeSrikanth Sombhatla
Created2015-10-23T20:58:55.000+0000
Updated2015-10-28T17:32:17.000+0000

Description

*Note: This is a regression but don't know when this broke. I went back till SDK 4.1.1.GA & could still see the issue.*

Steps To Reproduce:

1. Use the following code in your app.js :
var win = Ti.UI.createWindow({});

var but = Ti.UI.createButton({
	title:"lokesh"
});

win.add(but);
win.open();
2. Build for android device. 3. After the app launches check the button title.

Actual Results:

1. The button title stays uppercased even if the text is in lowercase in the app.js. NOTE: attached the screenshot for android & IOS for this issue.

Expected Results:

1. The button title should respect the case in the code.

Attachments

FileDateSize
Android_button_case.png2015-10-23T20:58:43.000+000041816
IOS_button_title.png2015-10-23T20:58:46.000+000024331

Comments

  1. Srikanth Sombhatla 2015-10-27

    Button text is automatically changed to ALLCAPS in material design. See https://www.google.com/design/spec/components/buttons.html# So the behaviour is according to the Android version the device is running. But in case you want to override this - provide your own style in Appc Studio. You can try something like this: In platform/android/res/values/mytheme.xml
       <resources>
       
           <!-- Base application theme. -->
           <style name="Theme.MyTheme" parent="Theme.AppCompat.Light.DarkActionBar">
               <!-- Customize your theme here. -->
               <item name="buttonStyle">@style/MyButton</item>
           </style>
       
           <style name="MyButton" parent="Widget.AppCompat.Button">
               <item name="android:textAllCaps">false</item>
           </style>
       </resources>
       
    And use this theme in tiapp.xml as described here http://docs.appcelerator.com/platform/latest/#!/guide/Android_Themes
  2. Lokesh Choudhary 2015-10-27

    [~sriks], With the custom theme the button title is lower cased, that's great. However, when I run the app without the custom theme on android 4.4.4 (which does not have material theme) I still see the button title as uppercased. Is this expected with android versions below 5.0 ?
  3. Srikanth Sombhatla 2015-10-28

    [~lchoudhary] Yes. Thats the expected behaviour because Android TiSDK uses AppCompact with Material theme support. So any widgets are automatically styled as material design.
  4. Lokesh Choudhary 2015-10-28

    [~ssombhatla], thanks for the clarification. Resolving this as invalid from above comments as this is an expected behaviour in material theme & when using appcompat with TiSDK.

JSON Source