Skip to content

Instantly share code, notes, and snippets.

@alanleard
Created January 16, 2013 19:03
Show Gist options
  • Save alanleard/4549797 to your computer and use it in GitHub Desktop.
Save alanleard/4549797 to your computer and use it in GitHub Desktop.
Android Vertical Slider
var win = Ti.UI.createWindow();
var container = Ti.UI.createView({
height:260,
width:30
})
var slider = Ti.UI.createView({
height:200,
width:20,
backgroundColor:'blue',
top:30
});
var button = Ti.UI.createView({
borderRadius:15,
height:30,
width:30,
top:15,
backgroundColor:'gray'
});
var label = Ti.UI.createLabel({
bottom:5,
color:'white'
});
var value = 0;
container.add(slider)
container.add(button);
win.add(label);
win.add(container);
button.addEventListener('touchmove', function(evt){
var point = button.convertPointToView({ x: evt.x, y: evt.y }, container);
if(point.y>15 && point.y<215){
button.top = point.y;
value = point.y-15
label.text=value;
}
});
win.open();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment