Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9280] Android: Scrollview+Textfields is not working properly (The textfield/view hides behind the keyboard, instead of scroll to be on top of the keyboard).

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionCannot Reproduce
Resolution Date2013-03-19T07:02:35.000+0000
Affected Version/sRelease 2.1.0
Fix Version/sRelease 3.0.2
ComponentsAndroid
Labelsapi
ReporterMauro Parra-Miranda
Assigneejithinpv
Created2012-05-25T12:01:31.000+0000
Updated2017-03-21T21:24:57.000+0000

Description

Problem Description

When customer uses scrollview to show several textfields, the textfields at the bottom won't be seen when clicked, since they hide under the softkeyboard.

Actual Results

The textfield in the scrollview is hidden under the keyboard.

Expected Results

The textfield scrolling properly, so you can see the textfield on top of the keyboard.

TestCase

1. Create mobile project. 2. Paste this app.js:
var win = Ti.UI.createWindow({
    title:'pippo',
    backgroundColor:'white',
    windowSoftInputMode:Ti.UI.Android.SOFT_INPUT_ADJUST_PAN,
    layout:'vertical',
    fullscreen:'false',
});
win.orientationModes = [Titanium.UI.PORTRAIT, Titanium.UI.UPSIDE_PORTRAIT, Titanium.UI.LANDSCAPE_LEFT, Titanium.UI.LANDSCAPE_RIGHT];


var curTop = 0;
 
 
function createRows(i) {
    var row = Titanium.UI.createView({
        width:'100%',
        height : Ti.UI.SIZE,
        left:0,
        bottom:0,
        backgroundColor : 'white',
        borderColor:'#bbb',
        borderWidth:1
    });
    var inputTextField = Titanium.UI.createTextField({
        color : '#ff7c00',
        top:10,
        height : 50,
        textAlign : 'right',
        width : '25%',
        hintText : '',
        left : '65%',
        right : '8%',
        borderStyle : Titanium.UI.INPUT_BORDERSTYLE_ROUNDED,
        keyboardType : Titanium.UI.KEYBOARD_NUMBERS_PUNCTUATION,
        returnKeyType : Titanium.UI.RETURNKEY_DONE,
        font : {
            fontSize : 20,
            fontColor : '#ff7c00',
            fontWeight : 'bold',
            fontFamily : 'Helvetica Neue'
        }	
    });
    /* inputTextField.addEventListener('focus', function(e) {
        Ti.API.info("Parent's height: "+ inputTextField.getParent().getHeight());
        Ti.API.info("Parent's top: "+ inputTextField.getParent().top);
        Ti.API.info("Size of the view: "+ inputTextField.getParent().size.height+" "+inputTextField.getParent().size.width+" "+inputTextField.getParent().size.x+" "+inputTextField.getParent().size.y);
        Ti.API.info("Size of the scrollview: "+scrollView.contentHeight);
        scrollView.scrollTo(0,(inputTextField.getParent().top-(Ti.Platform.displayCaps.platformHeight/4)));
    }); */ 
    inputTextField.addEventListener('return', function() {
        alert('return');
        inputTextField.blur();
    });
     
    row.add(inputTextField);
    return row;
}
 
 
var scrollView = Ti.UI.createScrollView({
   top:0,
   bottom:0,
   layout:'vertical',
    contentWidth:Ti.UI.SIZE,
    contentHeight:Ti.UI.SIZE
})

for( i = 0; i <= 20; i++) {
    var row = createRows(i);
   scrollView.add(row);
   curTop += 70;
};

if (i==20) {
	var viewFiller = Ti.UI.createView({
		opacity:30, 
		height:59,
		bottom:10
	})
	scrollView.add(viewFiller);
}

win.add(scrollView);
   
win.open();
3. Run it in a device (See extra info to see where is not working). 4. Click on the bottom textfield. 5. See that you can type, but you can't see what you typing

Extra info

We tested this case, and it's working in some cases, in others don't: Working fine: Android emulator - Works fine. Acer Iconia A500 - OS 3.2 - Working Fine Motorola Droid 1, running 2.2.3 - Working fine Motorola Droid 3 with Android 2.3.4 - Working fine. Failing: htc sprint slider device - PG06100, OS ver 2.2 - Does not work fine samsung galaxy Nexus - OS ver 4.0.2 - Does not work fine Motorola MB860 - OS ver 2.3.4 - Does not work fine htc spring non slider device PC36100 - OS ver 2.2 - Does not work fine

Comments

  1. jithinpv 2013-03-19

    Issue does not reproduces Tested with Titanium Studio, build: 3.0.1.201212181159 Titanium SDK version: 3.1.0 (03/11/13 15:43 0c88429) Titanium SDK version: 3.0.2 (02/07/13 16:46 a4def81) Device: Samsung galaxy s duos Android version: 4.0.4 jithinpv
  2. Lee Morris 2017-03-21

    Closing ticket as the issue cannot be reproduced.

JSON Source