Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8362] Android: Ti.UI.createScrollView sizing incorrectly in a vertical layout

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-07-10T02:30:04.000+0000
Affected Version/sRelease 2.0.0
Fix Version/sRelease 2.1.0, Sprint 2012-08
ComponentsAndroid
LabelsSupportTeam, api, module_scrollview, qe-testadded
ReporterShak Hossain
AssigneeHieu Pham
Created2012-03-27T12:08:24.000+0000
Updated2018-11-19T08:48:30.000+0000

Description

Problem

Setting Ti.UI.createScrollView.height to Ti.UI.SIZE causes the scrollView to take up the entire screen. If navBarHidden:true is set in app.js, a scrollView whose contents are minor will now scroll. This did not occur in Android 2.2.

Steps to Reproduce

Make a project with the below app.js.

Run in Android 4.0 emulator

You will see that most of the screen (excluding the custom navbar) is red. If you click and drag, you will see it scroll even though the components are very minor. One other point of interest, I added a label at the bottom of the window, but it is not visible since the scrollview wants to take up the entire parent.
var win = Ti.UI.createWindow({
  backgroundColor: '#7B6700',
  exitOnClose:true,
  layout:'vertical',
  navBarHidden:true
});

var NavBarView = Ti.UI.createView({height: '25dp',
                                   top:0,
                                   backgroundColor: 'green',
                                   width:'100%'});
                                   
var View1 = Ti.UI.createScrollView({left:'3dp',
                                    right:'3dp',
                                    height: Ti.UI.SIZE,
                                    showVerticalScrollIndicator:true,
                                    scrollType:'vertical',
                                    layout:'vertical',
                                    backgroundColor: 'red',
                                    showHorizontalScrollIndicator:false,
                                    touchEnabled: true
                                   });

var button = Ti.UI.createButton({title: 'Click',
                                 width: '100dp',
                                 height: '50dp'
                                });
                 
button.addEventListener('click', ButtonClick);

function ButtonClick(e)
{
  Ti.API.info('View1 height: ' + View1.size.height);
}

Label1 = Ti.UI.createLabel({text:'Label 1'});

View1.add(button);
win.add(NavBarView);
win.add(View1);
win.add(Label1);
win.open();

Comments

  1. Shawn Lipscomb 2012-03-28

    HD ticket: http://support.appcelerator.com/tickets/APP-225923/
  2. Olga Romero 2012-06-26

    Verified fix with Titanium Studio, build: 2.1.0.201206251749 Titanium SDK: 2.1.0.v20120626104306 Android 4.0 emulator
  3. Jon Barnhart 2012-07-05

    Verified fix with SDK 2.1.0.GA Thanks
  4. Neha Chhabra 2012-07-10

    Reopening to update labels.

JSON Source