Titanium JIRA Archive
Appcelerator Community (AC)

[AC-5565] Ti.UI.SIZE not working in Scroll View on Andorid

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionDuplicate
Resolution Date2018-03-15T22:17:44.000+0000
Affected Version/sAppcelerator Studio 4.5.0
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsn/a
ReporterBhushankumar pawar
AssigneeShak Hossain
Created2018-02-02T13:00:35.000+0000
Updated2018-05-08T18:12:48.000+0000

Description

Ti.UI.SIZE not working in Scroll View on Android after SDK onward 6.3.0 GA. Added label in scroll view and apply property of Ti.UI.SIZE to scroll view but it not taking it as size and it get's FILL across the screen.

Attachments

FileDateSize
Screen Shot 2018-02-05 at 11.48.55 AM.png2018-02-05T06:23:49.000+000083805

Comments

  1. Joshua Quick 2018-02-02

    [~bpawar], can you provide more details please? And test code to reproduce it? Because I can't reproduce this issue. The following code does a Ti.UI.SIZE on a label within a ScrollView and it does correctly size the label to just-fit the text. Note that the below shows a blue background for the label so that you can easily see it's actual width and height.
       var window = Ti.UI.createWindow();
       var scrollView = Ti.UI.createScrollView(
       {
       	layout: "vertical",
       //	layout: "composite",
       	showHorizontalScrollIndicator: false,
       	shorVerticalScrollIndicator: true,
       	width: Ti.UI.FILL,
       	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();
       
  2. Bhushankumar pawar 2018-02-03

    If we apply the width: Ti.UI.SIZE, to scroll view then the issue is observed. var window = Ti.UI.createWindow(); var scrollView = Ti.UI.createScrollView( { layout: "vertical", // layout: "composite", showHorizontalScrollIndicator: false, shorVerticalScrollIndicator: true, *{color:#d04437}width: Ti.UI.SIZE,{color}* 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();
  3. Sharif AbuDarda 2018-02-03

    Hello [~bpawar], I am also not able to reproduce the issue with the above sample code you provided. I also get the label with a blue background as the sample code by [~jquick], Thanks.
  4. Bhushankumar pawar 2018-02-05

    Thanks Sharif, Can you please check below code snippet. Here we can observe that scrollView(yellow background) is filling all window for android for iOS it is working fine. PFA. !Screen Shot 2018-02-05 at 11.48.55 AM.png|thumbnail! var window = Ti.UI.createWindow(); var scrollView = Ti.UI.createScrollView( { layout: "horizontal", // layout: "composite", showHorizontalScrollIndicator: false, shorVerticalScrollIndicator: true, width: Ti.UI.SIZE, height: Ti.UI.FILL, backgroundColor: "yellow", height : "40dp" }); 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();
  5. Joshua Quick 2018-02-05

    [~bpawar], I'm able to reproduce it now. Thanks. Right, the issue is that the ScrollView width ignores Ti.UI.SIZE and does a FILL instead. This issue was introduced when we added "RefreshControl" support to ScrollView. It's technically a bug on Google's end where their Java "SwipeRefreshLayout" class ignores the "WRAP_CONTENT" setting, which is the Android equivalent of our Ti.UI.SIZE setting. We'll have to work-around this issue and calculate it ourselves.
  6. Joshua Quick 2018-02-05

    I've written up a bug report for it here: [TIMOB-25753]
  7. Sharif AbuDarda 2018-03-15

    Waiting for the fix on 7.1.1 release.
  8. Joshua Quick 2018-05-08

    This issue was fixed in Titanium 7.1.1 which is available today.

JSON Source