Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-25819] Android: ScrollView starts at the wrong location if it contains a ListView

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2018-07-03T12:08:31.000+0000
Affected Version/sn/a
Fix Version/sRelease 7.3.0
ComponentsAndroid
Labelsandroid, bug, listview, scrollview, titanium
ReporterYahya Uddin
AssigneeJoshua Quick
Created2018-02-27T15:32:07.000+0000
Updated2018-07-03T22:25:38.000+0000

Description

When you have a ListView within a ScrollView on Android, sometimes the scroll view starts around the middle of the screen. e.g.
<Alloy>
	<Window class="container">
		<ScrollView backgroundColor="blue" width="Ti.UI.FILL" height="Ti.UI.FILL" layout="vertical">
			<View backgroundColor="red" width="Ti.UI.FILL" height="471">
				<Label top="0">Start of the screen</Label>
			</View>
			<ListView backgroundColor="yellow" height="347"/>
		</ScrollView>
	</Window>
</Alloy>
However changing the ListView into a normal view seems to fix the issue. In addition, there are times where the above window opens up fine. But most of the time it opens up incorrectly. Note that this does not happen on iOS. Tested on: - Samsung S6 (real device) and - Nexus 5 emulator (API 19) with SDK: Titanium 7.0.2 GA

Attachments

FileDateSize
how-it-should-look.png2018-02-27T15:30:01.000+000013493
how-it-starts-up.png2018-02-27T15:30:29.000+00009318

Comments

  1. Sharif AbuDarda 2018-02-27

    Hello, I was able to reproduce the issue on the Android with SDK 7.0.2.GA. Moving to TIMOB.
  2. Yordan Banev 2018-03-02

    PR: https://github.com/appcelerator/titanium_mobile/pull/9901
  3. Josh Longton 2018-06-11

    *Closing ticket as fixed* Verified using the steps in the description above, ScrollView starts at the top of the page now. {noformat} SDK Ver: 7.3.0.v20180607210411 OS Ver: 10.13.5 Appc NPM: 4.2.13 Appc CLI: 7.0.4-5 Ti CLI Ver: 5.1.1 Node Ver: 8.9.4 NPM Ver: 6.0.0 Emulator: 7.1.1 Pixel 2 XL: 8.1.0 {noformat}
  4. Joshua Quick 2018-06-29

    Everyone, The fix for this causes regression (see: [TIMOB-26167]) where a TextField/TextArea can no longer be edited if in a ScrollView. This issue needs to be solved a different way. I have a solution and plan on submitting a PR tomorrow.
  5. Joshua Quick 2018-06-30

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/10145
  6. Joshua Quick 2018-07-02

    PR (7.3.x): https://github.com/appcelerator/titanium_mobile/pull/10149
  7. Lokesh Choudhary 2018-07-03

    Verified the fix in SDK 7.3.0.v20180703051211 Closing. Studio Ver: 5.1.0.201806291005 SDK Ver: 7.3.0.v20180703051211 OS Ver: 4.2.13 Xcode Ver: 7.0.4 Appc NPM: 1.1.3 Appc CLI: 10.13.5 Daemon Ver: Xcode 9.4.1 Ti CLI Ver: 5.1.1 Alloy Ver: 1.12.0 Node Ver: 8.9.1 NPM Ver: 5.5.1 Java Ver: 10.0.1 Devices: ⇨ google Nexus 5 --- Android 6.0.1 ⇨ google Nexus 6P --- Android 8.1.0 Emulator: ⇨ Android 4.1.2

JSON Source