[TIMOB-25359] Android: ScrollView not scrolling when keyboard is showing
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Critical |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2017-10-04T18:05:32.000+0000 |
| Affected Version/s | Release 6.2.0 |
| Fix Version/s | Release 6.3.0 |
| Components | n/a |
| Labels | 6.2.2, android, bug, consider-6.2.3, regression, scrollview |
| Reporter | Guillermo Figueras |
| Assignee | Gary Mathews |
| Created | 2017-09-28T13:00:10.000+0000 |
| Updated | 2017-10-06T21:43:58.000+0000 |
Description
When using SDK 6.2.2GA on Android, ScrollView will not scroll when the keyboard is visible after clicking on a TextField.
When using SDK 6.2.0GA or 6.1.2GA it will work correctly.
See images attached and code below.
view.xml:
<Alloy>
<Window class="container" >
<ScrollView id="scrollView" showVerticalScrollIndicator="true">
<View id="userView" >
<ImageView class="icons" image="/icons/user.png" />
<TextField id="userTxt" />
<View bottom="0" width="Titanium.UI.FILL" height="1" backgroundColor="#d3d3d3" />
</View>
<View id="passView" >
<ImageView class="icons" image="/icons/lock.png" />
<TextField id="passTxt" />
<View bottom="0" width="Titanium.UI.FILL" height="1" backgroundColor="#d3d3d3" />
</View>
<Button id="registerGmailBtn" title="L('registerGmail')" />
<View id="btns">
<Button class="smallBtns" id="loginBtn" title="L('login')" />
<Button class="smallBtns" id="registerBtn" title="L('register')" />
</View>
<Button class="smallBtns" id="legalBtn" title="L('legalNotice')" />
<Switch value="true" />
</ScrollView>
</Window>
</Alloy>
tss:
".container" : {
backgroundColor: 'white'
}
".container[platform=android]" : {
exitOnClose : true
}
"Window[platform=android]":{
theme : 'Theme.AppCompat.NoTitleBar',
windowSoftInputMode: Ti.UI.Android.SOFT_INPUT_STATE_HIDDEN
}
"#scrollView": {
layout: 'vertical'
}
".icons" : {
left: 0,
width: "25dp",
height: "25dp"
}
"#userView" : {
top: "160dp",
width: "80%",
height: "50dp"
}
"#userTxt" : {
hintText : L('user'),
left: "10%",
right: "10%",
backgroundColor: 'transparent',
width: Titanium.UI.FILL,
hintTextColor: "grey",
color : "black"
}
"#passView" : {
width : "80%",
height : "50dp"
}
"#passTxt" : {
hintText : L('password'),
passwordMask: true,
left: "10%",
right: "10%",
backgroundColor: 'transparent',
width: Titanium.UI.FILL,
hintTextColor: "grey",
color : "black"
}
"#registerGmailBtn" : {
top: "20dp",
width: "80%"
}
"#btns" : {
top: "20dp",
height: Ti.UI.SIZE
}
".smallBtns" : {
width: "120dp"
}
"#loginBtn" : {
left: "10%"
}
"#registerBtn" : {
right: "10%"
}
"#legalBtn" : {
top: "40dp"
}
Attachments
| File | Date | Size |
|---|---|---|
| SDK 6.1.2GA & 6.2.0GA correct.mov | 2017-09-28T12:54:20.000+0000 | 2052265 |
| SDK 6.2.2GA wrong.mov | 2017-09-28T12:54:19.000+0000 | 917510 |
Here's the generated Alloy test case converted to JS that will reproduce the issue:
var win = Ti.UI.createWindow({ backgroundColor: "white", id: "index" }), scrollView = Ti.UI.createScrollView({ layout: "vertical", id: "scrollView", showVerticalScrollIndicator: true }), userView = Ti.UI.createView({ top: "160dp", width: "80%", height: "50dp", id: "userView" }), __alloyId0 = Ti.UI.createImageView({ left: 0, width: "25dp", height: "25dp", image: "/icons/user.png", id: "__alloyId0" }), userTxt = Ti.UI.createTextField({ hintText: L("user"), left: "10%", right: "10%", backgroundColor: "transparent", width: Titanium.UI.FILL, hintTextColor: "grey", color: "black", id: "userTxt" }), __alloyId1 = Ti.UI.createView({ bottom: 0, width: Titanium.UI.FILL, height: 1, backgroundColor: "#d3d3d3", id: "__alloyId1" }), passView = Ti.UI.createView({ width: "80%", height: "50dp", id: "passView" }), __alloyId2 = Ti.UI.createImageView({ left: 0, width: "25dp", height: "25dp", image: "/icons/lock.png", id: "__alloyId2" }), passTxt = Ti.UI.createTextField({ hintText: L("password"), passwordMask: true, left: "10%", right: "10%", backgroundColor: "transparent", width: Titanium.UI.FILL, hintTextColor: "grey", color: "black", id: "passTxt" }), __alloyId3 = Ti.UI.createView({ bottom: 0, width: Titanium.UI.FILL, height: 1, backgroundColor: "#d3d3d3", id: "__alloyId3" }), registerGmailBtn = Ti.UI.createButton({ top: "20dp", width: "80%", id: "registerGmailBtn", title: L("registerGmail") }), btns = Ti.UI.createView({ top: "20dp", height: Ti.UI.SIZE, id: "btns" }), loginBtn = Ti.UI.createButton({ width: "120dp", left: "10%", id: "loginBtn", title: L("login") }), registerBtn = Ti.UI.createButton({ width: "120dp", right: "10%", id: "registerBtn", title: L("register") }), legalBtn = Ti.UI.createButton({ width: "120dp", top: "40dp", id: "legalBtn", title: L("legalNotice") }), __alloyId4 = Ti.UI.createSwitch({ value: true, id: "__alloyId4" }); userView.add([__alloyId0, userTxt, __alloyId1]); passView.add([__alloyId2, passTxt, __alloyId3]); btns.add([loginBtn, registerBtn]); scrollView.add([userView, passView, registerGmailBtn, btns, legalBtn, __alloyId4]); win.add(scrollView); win.open();6_2_X: https://github.com/appcelerator/titanium_mobile/pull/9492
master: https://github.com/appcelerator/titanium_mobile/pull/9502 6_3_X: https://github.com/appcelerator/titanium_mobile/pull/9503
FR's passed, PR's merged.
Verified the fix with SDK's 6.3.0.v20171004141749 & 7.0.0.v20171004160733. Closing. Studio Ver: 4.10.0.201709271713 OS Ver: 10.12.3 Xcode Ver: Xcode 8.3.3 Appc NPM: 4.2.9 Appc CLI: 6.3.0-master.6 Ti CLI Ver: 5.0.14 Alloy Ver: 1.10.5 Node Ver: 7.10.1 Java Ver: 1.8.0_101 Devices: ⇨ google Nexus 5 --- Android 6.0.1 ⇨ google Pixel --- Android 7.1.1