Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-25753] Android: ScrollView "width" ignores Ti.UI.SIZE as of 6.3.0

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2018-03-21T17:41:46.000+0000
Affected Version/sRelease 6.3.0
Fix Version/sRelease 7.1.1
ComponentsAndroid
LabelsScrollView, android
ReporterJoshua Quick
AssigneeJoshua Quick
Created2018-02-05T18:59:39.000+0000
Updated2018-03-23T11:42:48.000+0000

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

FileDateSize
Screenshot-Bad.png2018-02-05T18:53:55.000+000042170
Screenshot-Good.png2018-02-05T18:53:59.000+000056232

Comments

  1. Joshua Quick 2018-02-28

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/9895 PR (7.1.x): https://github.com/appcelerator/titanium_mobile/pull/9896
  2. Lokesh Choudhary 2018-03-20

    Master FR passed.
  3. Lokesh Choudhary 2018-03-21

    FR Passed. PR's merged.
  4. Samir Mohammed 2018-03-23

    Verified in SDK Version 7.1.1.v20180322144031 and 7.2.0.v20180322112525. Test and other information can be found at: 7_1_X: https://github.com/appcelerator/titanium_mobile/pull/9896 Master: https://github.com/appcelerator/titanium_mobile/pull/9895

JSON Source