Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-7817] Android: scroll view is not drawn when added to a label

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionInvalid
Resolution Date2012-03-20T14:45:30.000+0000
Affected Version/sRelease 2.0.0
Fix Version/sn/a
ComponentsAndroid
Labelsparity
ReporterAllen Yeung
AssigneeMarshall Culpepper
Created2012-02-26T18:08:45.000+0000
Updated2017-03-24T18:15:35.000+0000

Description


var win = Ti.UI.createWindow();

var view = Ti.UI.createView({
	backgroundColor : '#336699',
	borderRadius : 10,
	width : 300,
	height : 2000,
	top : 10
});

var label2 = Ti.UI.createLabel({
	text : 'View Size is: ',
	top : 20,
	left : 10,
	height : 200,
	color : 'black'
});

var scrollView2 = Titanium.UI.createScrollView({
	contentHeight : 'auto',
	contentWidth : 'auto',
	showVerticalScrollIndicator : true,
	showHorizontalScrollIndicator : true
});

scrollView2.add(view);
label2.add(scrollView2);

win.addEventListener('click', function() {
	Ti.API.info("########################" + scrollView2.size.height);
	Ti.API.info("########################" + scrollView2.size.width);

});

win.add(label2);
win.open();
The scroll view is not shown, and when you click on the window, the height and width returns 0.

Comments

  1. Ivan Skugor 2012-03-07

    IMHO, this should be marked as invalid. Adding scroll view to a label is something like adding "div" to "label" in DOM world (a crazy thing to do that wouldn't do what you would expect). The problem is that label has "add" method (but it is not container and can't contain other components), which leads to confusion (other controls have that method also, it is documented, but it does nothing). I actually suggested that all UI components should be hierarchically ordered (controls, containers and contexts) so that situations like this would not happen, and that all this unnecessary methods should be removed (at least for documentation) but nobody listen to me anyway. :D
  2. Neeraj Gupta 2012-03-07

    @Ivan - Thanks for your earlier suggestion and we have decided to make this change after 2.0 release. This is more of a parity issue between iOS and Android platforms.
  3. Ivan Skugor 2012-03-08

    Glad to hear that. :) Namaskar Neeraj.
  4. Marshall Culpepper 2012-03-20

    As Ivan mentions, ScrollViews being added to labels is not something we will be able to support in Android, because Text controls do not allow this type of embedding. We will address the view container vs widget problem in the upcoming UI Layout Spec
  5. Lee Morris 2017-03-24

    Closing ticket as invalid with reference to the above comments.

JSON Source