Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Scroll Bar using Javascript

$
0
0

I'm a new app developer who's in the process of creating an Android application using Javascript. There's an image with text on it which doesn't fit on the whole window without the text being unreadable as it's squished. I would like to introduce a scroll bar so that the entire image can be viewed and the text on the image is legible. I don't really know what I'm doing and I'm sure it's probably quite a simple question. Code for the relevant window is attached below. Thanks in advance!

function create(obj) {
    var win = Titanium.UI.createWindow({
        title: obj.title || 'Untitled',
        layout:'vertical'
    });
 
 
 
    var screenWidth = Ti.Platform.displayCaps.platformWidth;
var screenHeight = Ti.Platform.displayCaps.platformHeight;
 
function GetHeight(value) {
    var temp = (value * 100) / 480;
    return parseInt((screenHeight * temp) / 100);
}
 
function GetWidth(value) {
    var temp = (value * 100) / 320;
    return parseInt((screenWidth * temp) / 100);
}
 
var scrollView = Ti.UI.createScrollView({
  contentWidth: 'auto',
  contentHeight: 'auto',
  showVerticalScrollIndicator: true,
  showHorizontalScrollIndicator: true,
  height: '80%',
  width: '80%'
});
 
    win.backgroundImage = "/images/LeamHomeback.png";
 
 
    var view = Titanium.UI.createView({
    width:Ti.UI.FILL,
    height:GetHeight(400),
    top:GetHeight(5),
 
});
scrollView.add(view);
win.add(view);
 
    var leambadge = Titanium.UI.createImageView({
            image:"/images/Leamingtonfcbadge.png",
            top: GetHeight(1),
 
            width: GetWidth(37),
            height: GetHeight(37),
        });   
        view.add(leambadge);
 
    var leamfixtures = Titanium.UI.createImageView({
        image:"/images/Leamfixtures.png",
        top: GetHeight(38),
 
        width: GetWidth(130),
        height: GetHeight(325),
    }); 
        view.add(leamfixtures);
 
 
 
        win.open();
 
    // trying to create a button to close the window
    var btnClose = Titanium.UI.createButton({
        title:'Close',
        bottom: 20,
 
        height: 30,
        width: 75,
        font:{fontFamily:'Trebuchet MS',fontSize:10}
 
    });
    win.add(btnClose);
    btnClose.addEventListener('click', function() {
        win.close();
    }); 
 
 
    return win;
} 
exports.create = create;

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>