Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-13868] Android: ScrollableView pages within ListView not displayed correctly

GitHub Issuen/a
TypeSub-task
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2013-11-07T22:29:56.000+0000
Affected Version/sRelease 3.1.0, Release 3.2.0
Fix Version/s2013 Sprint 23, 2013 Sprint 23 API, Release 3.2.0
ComponentsAndroid
Labelsn/a
ReporterPhilippe Wueger
AssigneeHieu Pham
Created2013-05-14T08:13:40.000+0000
Updated2017-03-22T00:16:26.000+0000

Description

*Problem* The pages of a ScrollableView are not drawn correctly when placed within a ListView. *Steps to reproduce* 1. Launch the app with the code below. 2. Scroll to the third page on the ScrollableView. 3. Problem: The third page is not displayed (no green background is shown). (The first two pages are displayed correctly). 4. Scroll back to the first page. Problem: This page is now also not displayed anymore. 5. Scroll down the list, so that the ScrollableView leaves the screen. 6. Scroll up again. The first page of the ScrollableView is now displayed correctly again. Note: Scrolling the ScrollableView within the ListView works much better when the fix of issue TIMOB-13610 is used. *Test Case*
var win = Ti.UI.createWindow();

var scrollableViewTemplate = {
	childTemplates: [
     {
    	 type: 'Ti.UI.ScrollableView',
    	 bindId: 'scrollableView',
    	 properties: {
    		 height: '200dp',
    		 views: [
    			 Ti.UI.createView({ backgroundColor: 'red'}),
    			 Ti.UI.createView({ backgroundColor: 'blue'}),
    			 Ti.UI.createView({ backgroundColor: 'green'})
    		 ]
    	 }
     }
	]
};

var items = [
	{ template: 'scrollableView'}
];

for ( var i = 0; i < 20; i++) {
	items.push({ properties: { title: 'Item', height: '50dp'}});
}

var section = Ti.UI.createListSection({
	items: items
});

var listView = Ti.UI.createListView({
	templates: {
		'scrollableView': scrollableViewTemplate
	},
	sections: [ section ]
});

win.add(listView);
win.open();

Comments

  1. Daniel Sefton 2013-05-14

    Hi Philippe, Please take a look at TIMOB-13610, I believe it's the same issue. Would be even better if you could try out the pull request if you know how to build Titanium. Thanks.
  2. Philippe Wueger 2013-05-15

    Hi Daniel Thanks for looking into this. This issue is not the same as the one described in TIMOB-13610. TIMOB-13610 is regarding the scrolling behavior of a ScrollableView within a ListView/TableView/ScrollView (how the scrolling is affected by the user touching the screen). This issue here is about the problem that, after scrolling to a new page, the view within the scrolled in page does not appear at all. Also, the issue here only occurs in a ListView, but does not occur in a TableView. With regards to the pull request from TIMOB-13610: I have tested it with TableViews and ListViews and it works very good. Regards, Philippe
  3. Philippe Wueger 2013-05-21

    The problem seems to be caused by the ListViewWrapper onLayout Method in TiListView.java. If I change this:
       if (changed) {
       	focusedView.setOnFocusChangeListener(focusListener);
       	focusListener.onFocusChange(focusedView, false);
       } else {
       	//Ok right now focus is with listView. So set it back to the focusedView
       	focusedView.requestFocus();
       	focusedView.setOnFocusChangeListener(focusListener);
       }
       
    to this:
       focusedView.setOnFocusChangeListener(focusListener);
       focusListener.onFocusChange(focusedView, false);
       
    the issue goes away. However, at the moment I do not know what the side effects are from this change. So this still needs to be checked.
  4. Hieu Pham 2013-11-07

    master PR: https://github.com/appcelerator/titanium_mobile/pull/4928
  5. Lee Morris 2017-03-22

    Closing ticket as fixed.

JSON Source