Titanium JIRA Archive
Appcelerator Community (AC)

[AC-2180] [Android] Google Maps API v2 does not work in a scrollview

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionWon't Fix
Resolution Date2013-03-19T20:02:49.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAppcelerator Modules
Labelsandroid, mapview, scrollview
ReporterMartin Eckardt
AssigneeMauro Parra-Miranda
Created2013-03-17T20:01:03.000+0000
Updated2016-03-08T07:41:10.000+0000

Description

Problem

A mapview in a scrollview should not leave behind a black box when scrolled. This works in Android 4.x but NOT in Android 2.3.x

Test case

var MapModule = require('ti.map');

var win = Ti.UI.createWindow({
	backgroundColor: 'white'
});

var vert = Ti.UI.createScrollView({
	contentHeight: 'auto',
	scrollType: 'vertical',
	showVerticalScrollIndicator: true,
	layout:'vertical',
	canCancelEvents: false,
	width: Ti.UI.SIZE
});

var mapview = MapModule.createView({
	height: 250,
    mapType: MapModule.NORMAL_TYPE,
    region: {latitude: -33.87365, longitude: 151.20689, latitudeDelta: 0.1, longitudeDelta: 0.1 },
});

vert.add(Ti.UI.createView({
	height: 200, width: 100, backgroundColor: 'red'
}))

vert.add(Ti.UI.createView({
	height: 150, width: 100, backgroundColor: 'blue'
}))

vert.add(mapview);

vert.add(Ti.UI.createView({
	height: 300, width: 100, backgroundColor: 'green'
}))

win.add(vert);

win.open();


Attachments

FileDateSize
IMG_0592.PNG2013-03-19T18:54:31.000+0000340995

Comments

  1. Carter Lathrop 2013-03-19

    Martin, It is generally not good code practice to have a map view within a scroll view. Good coding practices suggest having a mapview in its own window. If you want the ability to have a map within a scrolling view, it is suggested to use a web view to achieve this. Is there a specific reason why you need to have a map view within a scroll view? Regards, Carter
  2. Martin Eckardt 2013-03-19

    Hi Carter, Thanks for your answer. I attached you a screenshot from the iphone window. I want to show the user a quick overview how far the current location is from the shown place. Regards, Martin
  3. Carter Lathrop 2013-03-19

    Martin, Would you mind adding the screenshots of the working behavior in android 4.x and the broken behavior in 2.3.x while I look into this? Thanks, Carter
  4. Carter Lathrop 2013-03-19

    I spoke to engineering about this issue and they informed me that the method of having scroll views within scroll views will not work (100% of the time) in android. The way that views are nested in the android OS does not permit flawless implementation of nested scroll views. For this reason, we cannot support this method. This isn't an issue with the Titanium platform, rather a limitation applied by the Android SDK. So unfortunately we are unable fix this problem from our end. Regards, Carter

JSON Source