Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7002863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:59:03+00:00 2026-05-27T20:59:03+00:00

I am currently making a module, which does the hard work for you with

  • 0

I am currently making a module, which does the hard work for you with scrollviews. When I run this code on the iPhone simulator, it’s perfect – no bugs. On the android emulator, I just see a blank screen?

Why do I only see a blank screen, and how do I fix it?
Here is my code:

window = Ti.UI.createWindow({
    backgroundColor : 'white'
});

function SuperScrollView(window) {
    this.scrollview = Ti.UI.createScrollView({
        showVerticalScrollIndicator : true,
        height : window.height,
        width : window.width,
        contentHeight : 'auto'
    });
    this.view = Ti.UI.createView({
        height : 0,
        width : window.width
    });
    this.addElement = function(element) {
        var height = this.view.height;
        var elementHeight = element.height;
        element.top = height;
        this.view.add(element);
        this.view.height += elementHeight;
        height = this.view.height;
        this.scrollview.contentHeight = height;
        alert(height);
    }
    this.scrollview.add(this.view);
    window.add(this.scrollview);
}

var scrollview = new SuperScrollView(window);
scrollview.addElement(Ti.UI.createView({
    width : 200,
    height : 500,
    backgroundColor : 'blue'
}));

window.open();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T20:59:04+00:00Added an answer on May 27, 2026 at 8:59 pm

    The problem is that you’re relying on window.width and window.height, and these evaluate to 0 on Android (whereas they work fine on iOS). This results in your view not having any size. It’s better to use Ti.Platform.displayCaps.platformWidth and Ti.Platform.displayCaps.platformHeight to get the dimensions of the screen. You’ll need to be aware that this will be different on each platform, and size your views accordingly, but then you’d always have that problem.

    I’ve altered your code slightly so you can see it in action on both platforms.

    window = Ti.UI.createWindow({
        backgroundColor : 'white'
    });
    
    function SuperScrollView(window) {
        this.scrollview = Ti.UI.createScrollView({
            showVerticalScrollIndicator : true,
            height : Ti.Platform.displayCaps.platformHeight,
            width : Ti.Platform.displayCaps.platformWidth,
            contentHeight : 'auto'
        });
        this.view = Ti.UI.createView({
            height : 0,
            width : Ti.Platform.displayCaps.platformWidth
        });
        this.addElement = function(element) {
            var height = this.view.height;
            var elementHeight = element.height;
            element.top = height;
            this.view.add(element);
            this.view.height += elementHeight;
            height = this.view.height;
            this.scrollview.contentHeight = height;
            alert(height);
        }
        this.scrollview.add(this.view);
        window.add(this.scrollview);
    }
    
    var scrollview = new SuperScrollView(window);
    scrollview.addElement(Ti.UI.createView({
        width : 200,
        height : Ti.Platform.displayCaps.platformHeight + 500,
        backgroundColor : 'blue'
    }));
    
    window.open();
    

    EDIT: The other thing you can do is wait until the window had opened, and then add the scrollview to it once the width and height have been evaluated:

    window = Ti.UI.createWindow({
        backgroundColor : 'white'
    });
    
    function SuperScrollView(window) {
        this.scrollview = Ti.UI.createScrollView({
            showVerticalScrollIndicator : true,
            height : window.height,
            width : window.width,
            contentHeight : 'auto'
        });
        this.view = Ti.UI.createView({
            height : 0,
            width : window.width
        });
        this.addElement = function(element) {
            var height = this.view.height;
            var elementHeight = element.height;
            element.top = height;
            this.view.add(element);
            this.view.height += elementHeight;
            height = this.view.height;
            this.scrollview.contentHeight = height;
            alert(height);
        }
        this.scrollview.add(this.view);
        window.add(this.scrollview);
    }
    
    
    window.open();
    
    window.addEventListener('open', function(){
        var scrollview = new SuperScrollView(window);
        scrollview.addElement(Ti.UI.createView({
            width : 200,
            height : window.height + 500,
            backgroundColor : 'blue'
        }));
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently making an iphone web app based on Google App Engine (python). I
I'm currently making an iPhone app that has PDF viewing a crucial part of
I'm currently having difficulty finding a way of making my loops work. I have
currently making a SOAP request using Java's SOAPConnectionFactory and SOAPConnection 's .call() method, which
I'm making a small Python program, which calls the webbrowser module to open a
At work we currently use the following deployment strategy: Run a batch script to
I'm currently making a front end to display license information for my companies software
I'm currently making a GWT project where I display some HTML in a RichTextArea
I'm currently making some system that will gather statistical reports from different sites, for
I have a question about tables in MySQL. I'm currently making a website where

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.