Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-26539

Android: Label's default font size should be "dp" unless explicitly set

    Details

    • Story Points:
      1
    • Sprint:
      2018 Sprint 23, 2018 Sprint 24

      Description

      Summary:
      Android's Ti.UI.Label is currently hard-coded to a font size of 15 using the "tiapp.xml" property's "ti.ui.defaultunit". The problem with this is if you set the default unit to pixels (ie: px), then the label will default to "15px" and be too small to read on high DPI devices. The label's default font size should be hard-coded to "dp".

      We don't have this issue with any of our other UI features such as Button, TextField, Picker, etc. All other UI elements use "dp" by default. Only our Android Label has this problem.

      iOS does not have this problem.

      Steps to reproduce:

      1. Create a Titanium classic app.
      2. Set up the "tiapp.xml" file's default unit to "px" (pixels) as shown below.
      3. Use the "app.js" below.
      4. Build and run on an Android device that is xxhdpi or higher.
      5. Notice that the text is very tiny. (This is the bug.)

      tiapp.xml

      <ti:app xmlns:ti="http://ti.appcelerator.org">
      	<property name="ti.ui.defaultunit" type="string">px</property>
      </ti:app>
      

      app.js

      var window = Ti.UI.createWindow();
      window.add(Ti.UI.createLabel({ text: "Hello World" }));
      window.open();
      

      Android Results:

      iOS Results:

        Attachments

        1. Android-dp.png
          Android-dp.png
          42 kB
        2. Android-px.png
          Android-px.png
          39 kB
        3. ios-dp.png
          ios-dp.png
          99 kB
        4. ios-px.png
          ios-px.png
          99 kB

          Activity

            People

            • Assignee:
              jquick Joshua Quick
              Reporter:
              jquick Joshua Quick
              Reviewer:
              Gary Mathews
              Tester:
              Lokesh Choudhary
            • Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-6689
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Source Code