Search code examples
androidwidthtitaniumplatform

Make view 20 less than platformWidth android titanium


I have a tableViewRow with a view inside it.

Trying to set the view to the platormWidth - 20, with a left of 10, so it's centered.

This works fine on iOS but not android (see green rectange in photo below):

enter image description here

Why?

var innerView = Ti.UI.createView({
    width: Ti.Platform.displayCaps.platformWidth - 20,
    height: 20,
    backgroundColor: 'green',       
    left: 10,
    top: 10,
    layout: 'horizontal'
}); 

Thanks.


Solution

  • var innerView = Ti.UI.createView({
        height: 20,
        backgroundColor: 'green',       
        left: 10,
        right:10,
        top: 10,
       // layout: 'horizontal'
    });