Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9156] Android: TextField gets the focus when inside scrollView showing keyboard by default

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionInvalid
Resolution Date2012-05-22T17:11:30.000+0000
Affected Version/sRelease 2.0.1
Fix Version/sn/a
ComponentsAndroid
LabelsSupportTeam, api, parity
ReporterEduardo Gomez
AssigneePing Wang
Created2012-05-16T14:55:09.000+0000
Updated2017-03-09T23:28:33.000+0000

Description

Issue

A TextField gets the focus when inside scrollView showing keyboard by default will most likely happen at portrait mode.

Expected behavior

TextField do not get focus - (as seen in iOS or Android emulators screen shoots)

Current behavior

TextField do get focus - actual devices

Steps to reproduce

1. Run code below 2. Monitor unique app window

Repro sequence

var win = Titanium.UI.createWindow();

win.orientationModes = [
	//if you remove Portrait modes the keyBoard won't be displayed
	Titanium.UI.PORTRAIT,
	Titanium.UI.UPSIDE_PORTRAIT,
	Titanium.UI.LANDSCAPE_LEFT,
	Titanium.UI.LANDSCAPE_RIGHT
]; 

var scrolly = Titanium.UI.createScrollView({
	contentHeight:'auto'
});
win.add(scrolly);

var tf6 = Titanium.UI.createTextField({
	hintText:'custom background image',
	borderColor: 'red',
	height:32,
	top:235,
	backgroundImage:'KS_nav_views.png',
	paddingLeft:10,
	left:10,
	right:60,
	font:{fontSize:13},
	color:'#777',
	clearOnEdit:true
});


scrolly.add(tf6);

//adding text field to a window the keyboard doesn't gets displayed
//win.add(tf6);

win.open();

Tested on

LG Ally 2.2 - Titanium SDK 2.0.1 - keyboard doesn't gets displayed

05-16 16:42:03.153: I/ActivityManager(1347): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.appc.test/._1testyActivity }
05-16 16:42:03.473: I/ActivityManager(1347): Start proc com.appc.test for activity com.appc.test/._1testyActivity: pid=3719 uid=10065 gids={1015, 3003}
05-16 16:42:03.813: I/TiApplication(3719): (main) [0,0] checkpoint, app created.
05-16 16:42:04.163: I/TiApplication(3719): (main) [358,358] Titanium 2.0.1 (2012/04/12 16:36 999c68a)
05-16 16:42:04.753: I/TiApplication(3719): (main) [589,947] Titanium Javascript runtime: v8
05-16 16:42:05.283: I/TiRootActivity(3719): (main) [0,0] checkpoint, on root activity create, savedInstanceState: null
05-16 16:42:06.503: E/TiApplication(3719): (KrollRuntimeThread) [1222,1222] APP PROXY: ti.modules.titanium.app.AppModule@44a77a20
05-16 16:42:06.953: I/TiRootActivity(3719): (main) [0,0] checkpoint, on root activity resume. activity = com.appc.test._1testyActivity@44a10420
05-16 16:42:07.563: I/ActivityManager(1347): Displayed activity com.appc.test/._1testyActivity: 4115 ms (total 4115 ms)

Droid Razr 2.3.5 stack trace - keyboard gets displayed

05-16 16:21:53.390: I/ActivityManager(517): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.appc.test/._1testyActivity } from pid 880
05-16 16:21:53.421: D/ActivityRenderTarget(880): onPause
05-16 16:21:53.460: I/gralloc(517): Allocated 0x75617020 size 1029989747
05-16 16:21:53.484: I/TiRootActivity(6166): (main) [0,0] checkpoint, on root activity create, savedInstanceState: null
05-16 16:21:53.664: W/TiApplication(6166): (KrollRuntimeThread) [186,186] Registering module with name already in use.
05-16 16:21:53.664: E/TiApplication(6166): (KrollRuntimeThread) [0,186] APP PROXY: ti.modules.titanium.app.AppModule@40605ca8
05-16 16:21:53.742: W/TiUIScrollView(6166): (main) [72,258] Scroll direction could not be determined based on the provided view properties. Default VERTICAL scroll direction being used. Use the 'scrollType' property to explicitly set the scrolling direction.
05-16 16:21:53.757: I/TiRootActivity(6166): (main) [0,0] checkpoint, on root activity resume. activity = com.appc.test._1testyActivity@405ab190
05-16 16:21:53.781: W/InputManagerService(517): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@40b7e090 (uid=10035 pid=880)
05-16 16:21:53.789: I/gralloc(517): Allocated 0x660072 size 6488161
05-16 16:21:53.835: I/ActivityManager(517): Displayed com.appc.test/._1testyActivity: +359ms
05-16 16:21:53.843: D/LatinKeyboard(710): updateF1Key-mIsAlphaKeyboard: true ,mHasVoiceButton: true
05-16 16:21:53.843: D/LatinKeyboard(710): updateF1Key-mIsAlphaKeyboard: true ,mHasVoiceButton: true
05-16 16:21:53.859: I/gralloc(517): Allocated 0x660072 size 6488161
05-16 16:21:53.867: I/gralloc(517): Allocated 0x660072 size 6488161
05-16 16:21:53.921: D/dalvikvm(710): GC_EXTERNAL_ALLOC freed 33K, 48% free 4975K/9479K, external 5325K/5473K, paused 48ms
05-16 16:21:53.945: I/gralloc(517): Allocated 0x660072 size 6488161

Android emulator 2.3.3 stack trace - Titanium SDK 2.0.1 (keyboard doesn't gets displayed)

[INFO][ActivityManager(   60)] Start proc com.appc.test for activity com.appc.test/._1testyActivity: pid=330 uid=10039 gids={1015, 3003}
[INFO][TiApplication(  330)] (main) [0,0] checkpoint, app created.
[INFO][TiApplication(  330)] (main) [270,270] Titanium 2.0.1 (2012/04/12 16:36 999c68a)
[INFO][TiApplication(  330)] (main) [11,816] Titanium Javascript runtime: v8
[INFO][TiRootActivity(  330)] (main) [0,0] checkpoint, on root activity create, savedInstanceState: null
[ERROR][TiApplication(  330)] (KrollRuntimeThread) [3009,3009] APP PROXY: ti.modules.titanium.app.AppModule@43ea0068
[WARN][V8Object(  330)] Runtime disposed, cannot set property 'userAgent'
[INFO][TiRootActivity(  330)] (main) [0,0] checkpoint, on root activity resume. activity = com.appc.test._1testyActivity@43e7b658
[INFO][ActivityManager(   60)] Displayed activity com.appc.test/._1testyActivity: 6439 ms (total 6439 ms)

Android emulator 2.3.3 stack trace - Titanium SDK 2.1.0 (keyboard doesn't gets displayed)

[INFO][ActivityManager(   60)] Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.appc.test/._1testyActivity }
[INFO][ActivityManager(   60)] Start proc com.appc.test for activity com.appc.test/._1testyActivity: pid=268 uid=10039 gids={1015, 3003}
[INFO][dalvikvm(  260)] JNI: AttachCurrentThread (from ???.???)
[INFO][AndroidRuntime(  260)] NOTE: attach of thread 'Binder Thread #3' failed
[INFO][TiApplication(  268)] (main) [0,0] checkpoint, app created.
[INFO][TiApplication(  268)] (main) [198,198] Titanium 2.1.0 (2012/04/19 17:26 7427bdd)
[INFO][TiApplication(  268)] (main) [9,593] Titanium Javascript runtime: v8
[INFO][TiRootActivity(  268)] (main) [0,0] checkpoint, on root activity create, savedInstanceState: null
[ERROR][TiApplication(  268)] (KrollRuntimeThread) [1392,1392] APP PROXY: ti.modules.titanium.app.AppModule@43e964a8
[WARN][V8Object(  268)] Runtime disposed, cannot set property 'userAgent'
[WARN][TiUIScrollView(  268)] (main) [753,2145] Scroll direction could not be determined based on the provided view properties. Default VERTICAL scroll direction being used. Use the 'scrollType' property to explicitly set the scrolling direction.
[INFO][TiRootActivity(  268)] (main) [0,0] checkpoint, on root activity resume. activity = com.appc.test._1testyActivity@43e7aa40
[INFO][Launcher.Model(  118)] not binding apps: no Launcher activity
[INFO][ActivityManager(   60)] Displayed activity com.android.launcher/com.android.launcher2.Launcher: 22257 ms (total 22257 ms)
[INFO][ActivityManager(   60)] Displayed activity com.appc.test/._1testyActivity: 6119 ms (total 6119 ms)
[WARN][TiAnalyticsSvc(  268)] (Thread-13) [27239,27239] Analytics Service Started
[INFO][TiAnalyticsSvc(  268)] (Thread-13) [135,27374] Sending 10 analytics events.
[WARN][KeyCharacterMap(  108)] No keyboard for id 0
[WARN][KeyCharacterMap(  108)] Using default keymap: /system/usr/keychars/qwerty.kcm.bin

Attachments

FileDateSize
2.0.1_& _2.1.0._Droid_textField.jpg2012-05-16T14:55:09.000+0000109549
2.0.1._iOS_textField.jpg2012-05-16T14:55:09.000+000032748

Comments

  1. Ping Wang 2012-05-22

    It's a native Android behavior that TextField gets the focus when inside scrollView. There is a workaround by using a window property [windowSoftInputMode](http://docs.appcelerator.com/titanium/2.0/#!/api/Titanium.UI.Window-property-windowSoftInputMode) to stop the soft keyboard showing up automatically.
       windowSoftInputMode: Ti.UI.Android.SOFT_INPUT_STATE_HIDDEN
       
  2. Eduardo Gomez 2012-05-22

    Thanks, I've tested & relayed this important info to customer.
  3. Lee Morris 2017-03-09

    Closing ticket as invalid.

JSON Source