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

Android: maxLines not working for Ti.UI.Label (regression)

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: Release 6.0.2
    • Fix Version/s: Release 6.0.3
    • Component/s: Android
    • Environment:

      Titanium SDK 6+
      Moto G 4th with Android 6.0.1

    • Story Points:
      5
    • Sprint:
      2017 Sprint 06 SDK

      Description

      Label's property maxLines seems not to work since SDK 6 on Android.
      https://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.Label-property-maxLines

      I've tested it on SDK 5.1.x and 5.5.x and it does work.
      On 6.0.2.GA, or 6.1.0.v20170312111734 it DOES NOT work.
      The funny thing is that it works correctly when the Label is inside a List Item template.

      here is a test code:

      var win = Ti.UI.createWindow({
         theme: "Theme.AppCompat.Fullscreen",
         backgroundColor: '#fff'
      });
       
      var longString = "Welcome to the Appcelerator Platform! The Appcelerator Platform extends Appcelerator's Titanium platform to help you manage the entire lifecycle of the application with debugging, testing, deployment, crash monitoring and analytic data collection.";
      var bigLabel = Ti.UI.createLabel({
         text:longString,
         color:'#4d4d4d',
         width:'90%',
         top:10,
         lines:1
      });
      win.add(bigLabel);
      bigLabel.setMaxLines(1);
       
      var myTemplate = {
         childTemplates: [
            {
               type: 'Ti.UI.Label',
               bindId: 'info',
               properties: {
                  color:'#4d4d4d',
                  left:0,
                  maxLines:1
               }
            }
         ]
      };
       
      var listView = Ti.UI.createListView({
         top:300,
         width:'90%',
         templates: { 'template': myTemplate },
         defaultItemTemplate: 'template'
      });
      var sections = [];
       
      var fruitSection = Ti.UI.createListSection();
      var fruitDataSet = [
         {
            info: { text: longString }
         },
      ];
      fruitSection.setItems(fruitDataSet);
      sections.push(fruitSection);
      listView.setSections(sections);
      win.add(listView);
       
      win.open();
      

        Attachments

          Activity

            People

            • Assignee:
              fmerzadyan Frankie Merzadyan (Inactive)
              Reporter:
              chmiiller Carlos Henrique Zinato
              Reviewer:
              Andy Waldman
              Tester:
              Samir Mohammed
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

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

                  Git Source Code