How to Dynamically load image view in a scrollview.

You must Login before you can answer or comment on any questions.

Hi all , i have a scrollview , on that scrollview there is a view and on that view there are many image views(say 25 to 30). I just want that images should be loaded as the user scrolls down not at once when the app getting started.

Thanks

— asked 1 year ago by mathew orleans
1 Comment
  • var win=Titanium.UI.currentWindow;
    Ti.API.info("Available memory: " + Ti.Platform.availableMemory);
    var scrollView = Titanium.UI.createScrollView({
        contentWidth:'auto',
        contentHeight:20000,
        top:0,
        showVerticalScrollIndicator:true,
        //showHorizontalScrollIndicator:true
    });
    var view = Ti.UI.createView({
        //backgroundColor:'#336699',
        //borderRadius:10,
        width:320,
        height:20000,
        top:10
    });
     
     
    var image=Titanium.UI.createImageView({
        image:'images/pic1.png',
        height:430,
        width:320,
        top:0
    });
     
     
    view.add(image);
     
    var image2=Titanium.UI.createImageView({
        image:'images/earth.png',
        height:180,
        top:700,
        width:200
     
    });
     
    view.add(image2)
     
     
    var image3=Titanium.UI.createImageView({
        image:'images/pic2.png',
        height:220,
        top:850,
        width:300
     
    });
     
    view.add(image3);
     
    var image4=Titanium.UI.createImageView({
        image:'images/pic3.png',
        height:220,
        top:888,
        width:170,
        left:140
     
    });
     
    view.add(image4);
     
    var image5=Titanium.UI.createImageView({
        image:'images/pic4.png',
        height:220,
        top:1050,
        width:300,
     
     
    });
     
    view.add(image5);
    var image6=Titanium.UI.createImageView({
        image:'images/pic5.jpg',
        height:420,
        top:1250,
        width:300,
     
     
    });
     
    view.add(image6);
     
    var image7=Titanium.UI.createImageView({
        image:'images/pic6.png',
        height:420,
        top:1700,
        width:300,
     
     
    });
     
    view.add(image7);
    var image8=Titanium.UI.createImageView({
        image:'images/pic7.jpg',
        height:420,
        top:2050,
        width:300,
     
     
    });
     
    view.add(image8);
    scrollView.add(view);
     
     
    Ti.API.info("Available memory: " + Ti.Platform.availableMemory);
     
    win.add(scrollView);

    — commented 1 year ago by mathew orleans

1 Answer

Your Answer

Think you can help? Login to answer this question!