Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-8362

Android: Ti.UI.createScrollView sizing incorrectly in a vertical layout

    Details

    • Story Points:
      3

      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

      1. Make a project with the below app.js.
      2. 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.

      Bar.java

      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();
      
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                hpham Hieu Pham
                Reporter:
                shossain Shak Hossain
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-12704
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Source Code