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

Android: Adding WebView to ScrollView causes ScrollView to be initialized scrolled-down

    Details

      Description

      Issue

      When a WebView is added to a ScrollView containing multiple views stacked vertically, the scrollView get scrolled down to where the WebView has been added (bottom), causing the page to load with the ScrollView initially displaying Accounts near the bottom of the list.

      Sample Test case

      Titanium.UI.setBackgroundColor('#000');
      var win = Ti.UI.createWindow({
          backgroundColor : 'white'
      });
       
      //Create scroll view
      var scrollView = Titanium.UI.createScrollView({
          contentHeight : 'auto',
          layout : 'vertical',
          backgroundColor : 'transparent',
          showVerticalScrollIndicator : true
      });
       
      //Add to scrollView
      for (var i = 0; i < 20; i++) {
          scrollView.add(Titanium.UI.createView({
              height : 85,
              width : 300,
              backgroundColor : 'blue',
              top : 10,
              borderRadius : 6
          }));
       
      }
       
      //Add webView -- causes scrollView to scroll down
      var webView = Ti.UI.createWebView({
          touchEnabled : false,
          showScrollbars : false,
          scrollType : 'vertical',
          willHandleTouches : false,
          backgroundColor : 'red',
          scrollable : false,
          top : 20,
          height : 40
      });
       
      scrollView.add(webView);
       
      win.add(scrollView);
      win.open(); 
      

      In iOS, the top most view is visible first.

        Attachments

          Activity

            People

            • Assignee:
              ayeung Allen Yeung
              Reporter:
              vjoshi Varun Joshi
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

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

                  Git Integration