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

Android: ScrollView "width" ignores Ti.UI.SIZE as of 6.3.0

    Details

    • Story Points:
      1
    • Sprint:
      2018 Sprint 06 SDK

      Description

      Summary:
      Setting the ScrollView "width" property to "Ti.UI.SIZE" will do a "Ti.UI.FiLL" instead as of Titanium 6.3.0.
      (This is not an issue with the "height" property. Only the "width".)

      Code to Reproduce:

      var window = Ti.UI.createWindow();
      var scrollView = Ti.UI.createScrollView(
      {
      	layout: "vertical",
      	showHorizontalScrollIndicator: false,
      	shorVerticalScrollIndicator: true,
      	backgroundColor: "yellow",
      	width: Ti.UI.SIZE,
      	height: Ti.UI.FILL,
      });
      scrollView.add(Ti.UI.createLabel(
      {
      	text: "Hello World",
      	color: "white",
      	backgroundColor: "blue",
      	width: Ti.UI.SIZE,
      	height: Ti.UI.SIZE,
      }));
      window.add(scrollView);
      window.open();
      

      Result:
      The above code produces a yellow ScrollView. Note that the ScrollView does not auto-size itself to just fit the "Hello World" label as seen in "Screenshot-Bad.png".

      Expected Result:
      The ScrollView width should auto-size itself to fit the label as shown in "Screenshot-Good.png". This is how it worked in Titanium 6.2.2 and older versions.

      Cause:
      This bug happened when we added "RefreshControl" support. Google's Java "SwipeRefreshLayout" class does not support the "WRAP_CONTENT" setting.

      Recommended Solution:
      Modify Titanium's Java "TiSwipeRefreshLayout" onMeasure() method to handle the "WRAP_CONTENT" setting ourselves. We're already doing this in the vertical direction and we need to do the same for the horizontal.
      https://github.com/appcelerator/titanium_mobile/blob/master/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiSwipeRefreshLayout.java#L76

        Attachments

        1. Screenshot-Bad.png
          41 kB
          Joshua Quick
        2. Screenshot-Good.png
          55 kB
          Joshua Quick

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

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

                    Git Source Code