Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I draw a line in Titanium?

How Do I draw a line in Titanium that works in both Android and iPhone?

like image 951
David Silva Smith Avatar asked Dec 29 '22 06:12

David Silva Smith


2 Answers

To create a line, I use;

var view = Ti.UI.createView({
    height:180,
    width:300
});

var line = Ti.UI.createView({
    height:2,
    bottom:0,
    left:0,
    right:0,
    borderWidth:1,
    borderColor:'#aaa'
 });

view.add(line);
like image 141
Mayor Brain Avatar answered Jan 09 '23 18:01

Mayor Brain


Add this to your view.xml

<View class="line"></View>

Add this to your style.tss

".line": {
    height: '2dp',
    bottom: '2dp',
    left: '0dp',
    right: '0dp',
    borderWidth: '1',
    borderColor:'#aaa',
}
like image 31
Ash Prasad Avatar answered Jan 09 '23 17:01

Ash Prasad