Skip to content

Instantly share code, notes, and snippets.

@MotiurRahman
Last active December 31, 2015 08:38
Show Gist options
  • Select an option

  • Save MotiurRahman/7961370 to your computer and use it in GitHub Desktop.

Select an option

Save MotiurRahman/7961370 to your computer and use it in GitHub Desktop.
android > small device textfield issue in landscape mode
/* Hi I have tested this jira issue. It's a one kinds of bug when we rotate the device in landscape mode and focus on textField
the textField is get expanded to full screen.
Testing Environment:
Android SDK: 4.2.2
Titanium SDK:3.1.3,
CLI version 3.1.2
Steps to Reproduce:
1. Create a sample Project.
2. Paste this code in app.js file.
3. Run this code with testing environment.
4. Rotate the device in landscape mode then see textField is get expanded to full screen.
*/
// Test Case
var win = Ti.UI.createWindow({backgroundColor: 'white',
layout:'vertical'
});
// Create a TextField.
var aTextField = Ti.UI.createTextField({
height : Titanium.UI.SIZE,
top : 10,
width : Titanium.UI.FILL,
hintText : 'This is hint text',
softKeyboardOnFocus : Ti.UI.Android.SOFT_KEYBOARD_DEFAULT_ON_FOCUS, // Android only
keyboardType : Ti.UI.KEYBOARD_DEFAULT,
returnKeyType : Ti.UI.RETURNKEY_DEFAULT,
borderStyle : Ti.UI.INPUT_BORDERSTYLE_ROUNDED
});
// Listen for return events.
aTextField.addEventListener('return', function(e) {
aTextField.blur();
alert('Input was: ' + aTextField.value);
});
// Add to the parent view.
win.add(aTextField);
// Create a TextField.
var aTextField1 = Ti.UI.createTextField({
height : Titanium.UI.SIZE,
top : 10,
width : Titanium.UI.FILL,
hintText : 'This is hint text',
softKeyboardOnFocus : Ti.UI.Android.SOFT_KEYBOARD_DEFAULT_ON_FOCUS, // Android only
keyboardType : Ti.UI.KEYBOARD_DEFAULT,
returnKeyType : Ti.UI.RETURNKEY_DEFAULT,
borderStyle : Ti.UI.INPUT_BORDERSTYLE_ROUNDED
});
// Listen for return events.
aTextField1.addEventListener('return', function(e) {
aTextField1.blur();
alert('Input was: ' + aTextField1.value);
});
// Add to the parent view.
win.add(aTextField1);
win.open();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment