[TIMOB-3296] Android: ScrollView does not scroll horizontally
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-09-01T12:42:05.000+0000 |
Affected Version/s | Release 1.6.0 |
Fix Version/s | Sprint 2011-35, Release 1.8.0 |
Components | Android |
Labels | scrollview |
Reporter | Rick Blalock |
Assignee | Vikramjeet Singh |
Created | 2011-04-15T03:41:38.000+0000 |
Updated | 2011-09-13T10:02:25.000+0000 |
Description
Horizontal scrolling does not work past the dimensions of the device's screen (unlike iOS implementation).
HD ticket: http://developer.appcelerator.com/helpdesk/view/76287">http://developer.appcelerator.com/helpdesk/view/76287
Sample:
Titanium.UI.setBackgroundColor('#fff');
var win = Titanium.UI.createWindow({
backgroundColor: '#fff'
});
var scrollView = Ti.UI.createScrollView({
contentWidth: 1100,
contentHeight: 367,
top:0,
left:0,
showVerticalScrollIndicator:false,
showHorizontalScrollIndicator:true,
backgroundColor:'#d6d0b7'
});
var imageView = Ti.UI.createImageView({
image: 'http://placehold.it/1094x367',
width: 1094,
height: 367,
top: 50,
left: 0
});
scrollView.add(imageView);
win.add(scrollView);
win.open();
Attachments
File | Date | Size |
---|---|---|
screenshot_337.png | 2011-08-31T15:14:14.000+0000 | 13728 |
Environment: * Ti 1.6.2 (main release) * Android 2.3.3 This seems to be a more general problem than the initial ticket implied. From my tests, horizontal scrolling does not work currently for Android scrollViews at all. See the following demonstration, where the relative vs absolute layouts and auto vs explicit dimensions can be toggled to show that scrolling does not work in either situation.
Associated HD ticket
A customer relies on this, http://appc.me/c/APP-139864HD Ticket.
An Enterprise customer relies on this. APP-346557In the documentation, there is a property for android
scrolltype
http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.UI.ScrollView-object you need to set it to"horizontal"
Since Android can only scroll in one direction or the other in ScrollView we have to guess. The default is"vertical"
the auto checks are as follows. if you provide a width and contentWidth and they are equalscrollType
is"vertical"
if you provide a height and contentHeight and they are equalscrollType
is"horizontal"
scrollType
overrides the default and our guesses with the explicitly requested scrolling direction.We're keeping this item open because we want to add a log statement indicating when our guesses cannot be done, i.e., indeterminate scrolling direction which defaults to vertical. We'll put a log warning that points to the scrollType property.
Note: This has been tested and works correctly in the following env, as per Don's post/explanation. * Android 2.1 * Titanium 1.7.3 (2011/08/05 10:18 ) * emulator
Testing the new warning message: Use this app.js and run it, check logcat and you should see the warning "W/TiUIScrollView ... Scroll direction could not be determined...".
Then do this one, which will deduce horizontal scrolling, and make sure the warning does **not** appear:
Then do this one, which will deduce vertical scrolling, and make sure the warning does **not** appear:
Pull req ready https://github.com/appcelerator/titanium_mobile/pull/433
Review and test.
Resolved. Warning is only displayed when expected Tested on: Mac OSX Lion TiMob: 1.8.0.v20110906155354 TiStud: 1.0.5.201109091616 Devices Used: Android Emulator 2.2 Droid3 Google Nexus S