scrollableview with text

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

hi everyone...ok so i created a scrollableview which works perfect..im using remote images...now my only problem is to have text on each view...can some one help me ?

function Celebrity(_args) {
    var self = Ti.UI.createWindow({
        title: 'Celebirty',
        barImage:'navbar.png',
    });
 
 
 
    var view2 = Ti.UI.createImageView({ url:'https://s3.amazonaws.com/music1127/bonifacio.jpg' });
var view3 = Ti.UI.createImageView({ url:'https://s3.amazonaws.com/music1127/foot.jpg' });
var view4 = Ti.UI.createImageView({ url:'https://s3.amazonaws.com/music1127/ramirez.jpg' });
var view5 = Ti.UI.createImageView({ url:'https://s3.amazonaws.com/music1127/pits.jpg' });
var view7 = Ti.UI.createImageView({ url:'https://s3.amazonaws.com/music1127/orieles.jpg' });
var view8 = Ti.UI.createImageView({ url:'https://s3.amazonaws.com/music1127/nelson.jpg' });
var view9 = Ti.UI.createImageView({ url:'https://s3.amazonaws.com/music1127/mets.jpg'});
var scrollableView = Ti.UI.createScrollableView({
  views:[view2,view3,view4,view5,view7,view8,view9,],
  showPagingControl:true
});
 
var backBtn = Ti.UI.createButton({ title : 'Back' });
 
backBtn.addEventListener('click', function(){
    self.close();
});
self.setLeftNavButton(backBtn);
        self.open({
            modal : true,
            animated : false
        });
 
 
    self.add(backBtn);
    self.add(scrollableView);
 
    return self;
};
module.exports = Celebrity;

1 Answer

You just need to add a label to your view.

var view2 = Ti.UI.createImageView({ url:'https://s3.amazonaws.com/music1127/bonifacio.jpg' });
var labl2 = Ti.UI.createLabel({text:'Label 2',color:'#fff'});
view2.add(labl2);

— answered 9 months ago by Anthony Decena
answer permalink
1 Comment
  • That will actually only work on iOS. If you want to do the same thing on Android then you'll have to turn your imageViews into regular views with a backgroundImage of the image you want to use. You can then add text to that view and add it to the scrollableView

    — commented 9 months ago by Anthony Decena

Your Answer

Think you can help? Login to answer this question!