Last active
August 29, 2015 14:01
-
-
Save exclusiveTanim/66de005d97125a90c927 to your computer and use it in GitHub Desktop.
Shading effect on button
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*shading effect on button without using an image. By using following code we can create button in different colours. | |
if we want to add Shading effect on a button without using an image, we use the backgroundGradient property on the button. | |
Here we can see the following example where a button with 3 gradient colours: red, blue and green.*/ | |
var testWin = Titanium.UI.createWindow({ | |
backgroundColor : '#ccc', | |
layout:'vertical' | |
}); | |
var imageView = Titanium.UI.createImageView({ | |
image : 'images1.jpeg', | |
width : 250, | |
height : 250, | |
backgroundColor : 'red', | |
borderColor : 'red', | |
borderRadius : 375, | |
borderWidth : 2, //(250 * 1.5) | |
}); | |
testWin.add(imageView); | |
Button = Titanium.UI.createButton({ | |
title:'Close', | |
width:150, | |
height:40, | |
top:10, | |
font:{fontSize:16,fontWeight:'bold'}, | |
backgroundGradient:{ | |
type:'linear', | |
colors:[{color:'red',position:0.0},{color:'blue',position:0.50},{color:'green',position:1.0}] | |
}, | |
}); | |
testWin.add(Button); | |
testWin.open(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment