Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19754] Android Textfield is not vertically aligned at center

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionInvalid
Resolution Date2017-05-03T08:22:49.000+0000
Affected Version/sRelease 5.0.1, Release 5.0.2, Release 5.0.0
Fix Version/sn/a
ComponentsAndroid
Labelsandroid, regression, texfield
Reporter Ricardo Ramirez
AssigneeGary Mathews
Created2015-10-20T20:23:24.000+0000
Updated2018-08-06T17:37:00.000+0000

Description

Issue Description

Text field text is not align centered in Android using the Titanium SDK 5.X, Is working good in Titanium SDK 3.5.1. verticalAlign: Ti.UI.TEXT_VERTICAL_ALIGNMENT_CENTER -> also is not working.

Steps to replicate:

-Create a new titanium classic project -Open the app.js file inside Resources -Replace the code with this:
var win = Ti.UI.createWindow({
  backgroundColor: 'white'
});

var textField = Ti.UI.createTextField({
  borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED,
  color: '#336699',
  backgroundColor: "red",
  top: 10, left: 10,
  width: 250
});

win.add(textField);
win.open();

Attachments

FileDateSize
4.4.4.png2015-10-29T22:14:24.000+000053561
5.0.0.png2015-10-29T22:14:24.000+000062894
Device-Nexus4-21-TIMOB-19754.png2015-11-25T08:31:46.000+000025247
latest_SS.png2015-11-30T19:19:10.000+0000136576
nexus4-23-TIMOB-19754.png2015-11-25T08:24:31.000+0000246512
Nexus4-ALLCAPS.png2015-12-01T07:18:48.000+000030658

Comments

  1. Hieu Pham 2015-10-28

    Ti.UI.TEXT_VERTICAL_ALIGNMENT_CENTER is working fine. If you want your text to appear in the center of the textfield, you should use:
       textAlign: Ti.UI.TEXT_ALIGNMENT_CENTER
       
  2. Ricardo Ramirez 2015-10-29

    Hello [~hpham] I want to center the text vertically, please see the attached screenshots. The textAlign: Ti.UI.TEXT_VERTICAL_ALIGNMENT_CENTER is working on Android 4 [4.4.4.png screenshot] but is not working on Android 5 [5.0.0.png screenshot], the textAlign: Ti.UI.TEXT_ALIGNMENT_CENTER property just center the text horizontally. This is happening in ally and classic, here is my test-case in classic:
       var win = Ti.UI.createWindow({
         backgroundColor: 'white'
       });
       
       var textField = Ti.UI.createTextField({
         borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED,
         color: '#336699',
         backgroundColor: "red",
         top: 10, left: 10,
         textAlign: Ti.UI.TEXT_VERTICAL_ALIGNMENT_CENTER ,
         width: 250
       });
       
       win.add(textField);
       win.open();
       
  3. Srikanth Sombhatla 2015-11-25

    [~rramirez], I checked the above test case and it works fine on Nexus 4 device and emulator. See attached screen shots. Please let me know if I am missing anything.
  4. Ricardo Ramirez 2015-11-25

    Nope, but you are running the app using the API 23 and I think that I was using the API 21, let me update my environment and try again using the 5.1.1.GA SDK and the API 23. I will keep you updated about the results. Thanks.
  5. Srikanth Sombhatla 2015-11-26

  6. Ricardo Ramirez 2015-11-30

    Hello ! I have tested using Genymotion emulating a Google Nexus 7 with Android 5.0.0 API 21and SDK 5.1.1.GA. Please Try typing Uppercase letters too. A new Screenshot is attached[latest_SS.png]
  7. Srikanth Sombhatla 2015-12-01

    [~rramirez] Not able to the issue. Attached screenshot [Nexus4-APPCAPS] which is working as expected! Can you do two things 1. Try running on a device/emulator - not Genymotion. 2. Run at least on Android 5.1. Because as I am trying to see similar occurrences I found someone reporting an alignment issue on early versions of lollipop. https://code.google.com/p/android/issues/detail?id=87795
  8. Hieu Pham 2015-12-01

    Tested with 4.4.2, 5.0.1, 5.1.1, and 6.0. This is only reproducible in 5.0.1. However, Lollipop is known for font rendering and misalignment issues. Google fixed this in 5.1. Closing this ticket as not our bug. Please open if you can reproduce this on devices that are NOT 5.0.x.
  9. Ingo Muschenetz 2015-12-14

    Do we have a specific bug from Google/Android in reference to alignment issues? I would like to reference that here.
  10. Srikanth Sombhatla 2015-12-15

    Not able to find specific bug report but here are few references to this issue https://code.google.com/p/android/issues/detail?id=87795 http://stackoverflow.com/questions/27945834/android-5-0-lollipop-is-not-displaying-special-characters-correctly
  11. Louis Quaintance 2016-03-11

    This is definitely a Titanium issue Create a native Android project and add: To the main activity xml file Deploy to a 5.0.1 device and its perfect. Do the same but in Titanium and its not aligned
  12. Ricardo Ramirez 2016-03-14

    [~nsalahin] try Android OS 5.0.0 and Android OS 5.1.0
  13. Mostafizur Rahman 2016-03-22

    Hello, Thanks for your contribution. I have tested that issue you reported. In titanium SDK 5.2.0 GA, the property “*verticalAlign:Ti.UI.TEXT_VERTICAL_ALIGNMENT_CENTER*” is working as expected in android 5.1.0 but doesn’t work in android 5.0.0. Please check [5.1.0| http://postimg.org/image/urmzqqyz1/], [5.0.0](http://postimg.org/image/evdj3i9k9/). *Test Environment:* Appcelerator Studio, build: 4.5.0.201602170821, Operating System Mac OS X -EI Capitan,Versio-10.11.1, Appcelerator Command-Line Interface, version 5.2.0, SDK Version = 5.2.0.GA, Node.js Version: 4.2.2 npm Version:2.14.7, Emulator: Custom phone / android 5.0.1, Nexus 5/ android 5.0.0 Thanks.
  14. Hans Knöchel 2016-08-20

    Any idea how I can get this working on Android 5.0.x? Theme-configuration or something?
  15. Sasa Savic 2017-01-25

    This is still an issue with the latest 5.5.1.GA as well as latest 6.x.x SDK's. Is this issue even being worked on? Also, are there any alternatives/workarounds.
  16. Gary Mathews 2017-02-09

    So this does appear to be an Android issue, and it depends on the type of view the TextView is added to: https://code.google.com/p/android/issues/detail?id=59700 https://code.google.com/p/android/issues/detail?id=59368
  17. Gary Mathews 2017-05-03

    Resolving as invalid as this is not our bug.
  18. Eric Merriman 2018-08-06

    Closing as invalid. If incorrect, please reopen.

JSON Source