Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

What's the best way to have a vertical scrolling page


SOLVED


This is probably a total newbie question, but I'm going to ask anyway.

I have a view where the text content exceeds the height allowed (it's not a list of items, just one big blob of text - a label to be more specific). What's the best way to display that content so a user can scroll down to see the bottom of the text.

I'm pretty sure a webview would work, but was trying not to use webviews due to the memory overhead caused by the browser.

What do you guys think?

— asked March 26th 2010 by Christopher Webb
  • height
  • iphone
  • label
  • mobile
  • newbie
  • scrollable
  • text
  • view
  • webview
0 Comments

6 Answers

  • i would just say a regular view?

    — answered March 26th 2010 by Glenn Tillemans
    permalink
    0 Comments
  • I think just a normal view would work, with auto height on the label:

    var label = Titanium.UI.createLabel({
        text: 'all your long text',
        height: 'auto'
    });
    
    — answered March 26th 2010 by Nick Haffie-Emslie
    permalink
    0 Comments
  • This may not be the best way, but similar to the Snapost demo, I have one main view and then am loading views into the main view. Is this not the way to do things any more? I've attempted to put height:'auto' on the label and on the respective views with no luck. Any other ideas?

    — answered March 26th 2010 by Christopher Webb
    permalink
    0 Comments
  • Found an answer.

    var viewContainer = Titanium.UI.createScrollView({
        contentWidth:'auto',
        contentHeight:'auto',
        top:55,
        showVerticalScrollIndicator:true,
        showHorizontalScrollIndicator:true
    });
    
    — answered March 26th 2010 by Christopher Webb
    permalink
    0 Comments
  • I have the solution and it will only be $29.00 at http://.. JK!

        this.view1 = Titanium.UI.createScrollView({
            contentWidth:'auto',
            contentHeight:'auto',
            showVerticalScrollIndicator:true,
            showHorizontalScrollIndicator:true
        });
    
        this.label1 = Titanium.UI.createLabel({
            color:'#fff',
            text: "",
            width: 310,
            font:{fontSize:30,fontFamily:'Helvetica Neue'},
            height: 'auto'
        });
    
        this.view1.add(this.label1);
    
        this.win1.add(this.view1);
    
    — answered April 6th 2010 by Alex Grande
    permalink
    0 Comments
  • I have the solution and it will only be $29.00 at http://.. JK!

        this.view1 = Titanium.UI.createScrollView({
            contentWidth:'auto',
            contentHeight:'auto',
            showVerticalScrollIndicator:true,
            showHorizontalScrollIndicator:true
        });
    
        this.label1 = Titanium.UI.createLabel({
            color:'#fff',
            text: "",
            width: 310,
            font:{fontSize:30,fontFamily:'Helvetica Neue'},
            height: 'auto'
        });
    
        this.view1.add(this.label1);
    
        this.win1.add(this.view1);
    
    — answered April 6th 2010 by Alex Grande
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.