Quantcast
Channel: Appcelerator Developer Center Q&A Tag Feed (keyboard)
Viewing all articles
Browse latest Browse all 352

Android textfield autofocus and cursor won't disappear

$
0
0

Having recently moved to Titanium, I've been struggling with this issue for the last few days. There are a lot of topics here and around the internet surrounding TextField focus issues on android, I've exhausted all of them and I now need someone's help desperately!

I essentially have 2 TextFields in a window. An email, and password textfield for logging in. When the window opens, the email text field get's focused and the keyboard opens, this is fine.

If I hit the "next" button on the keyboard, focus will switch to the password textfield. Again, this is fine.

Now the password textfield is in focus, I hit "done" on the keyboard. The keyboard closes, but the email textfield is given focus (I logged it to the console via the 'focus' event) and a cursor appears there. The keyboard remains closed, but a cursor is present!?!? Very weird.

I've tried blurring both textfields when the keyboard closes to get rid of the cursor, this doesn't do anything. I still get the 'focus' event on the email textfield. I'm wondering whether this happens automatically when the password textfield loses focus?

Essentially, all I want to do is remove the cursor from a textfield when the keyboard is closed.

If anyone has any ideas why this would be happening, help would be greatly appreciated!

Code below:

<TextField id='email' class='textfield' />
<TextField id='password' class='textfield' onReturn='keyboardClosed' />
function keyboardClosed() {
  $.email.blur();
  $.password.blur();
}
'.textfield': {
    width: '100%', 
    height: 40,
    borderStyle: Titanium.UI.INPUT_BORDERSTYLE_LINE, 
    borderWidth: 1, 
    borderColor: '#7f9b6a',
    paddingLeft: 10,
    color: '#c2c8b4',
    font: { fontWeight: 'bold', fontStyle: 'italic' },
    backgroundColor: 'transparent', 
    backgroundFocusedColor: 'transparent'
}

Viewing all articles
Browse latest Browse all 352

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>