Quantcast
Channel: Appcelerator Developer Center Q&A Tag Feed (android)
Viewing all articles
Browse latest Browse all 7655

A simple layout problem with 2 views in horizontal view.

$
0
0

Hi, I've a simple problem.

I need a horizontal view with 2 views inside (left & right): a left view (RED) with a fixed width ('170dp'), and other view (layout vertical) that should adjust the width to available (Ti.UI.FILL?)

Important: the main container does not cover the entire width of the device and should find a solution that is not knowing the full width available.

I've tried with this code, but don't works, this is the result.

var win = Ti.UI.createWindow();
 
    var container = Ti.UI.createView({
        top:0,
        layout : 'horizontal',
        backgroundColor:'black'
    });
 
    var leftview = Ti.UI.createView({
        width : '140dp',
        height : '140dp',
        backgroundColor : 'red'
    });
    container.add(leftview);
 
    var rightview = Ti.UI.createView({
        width : Ti.UI.FILL,
        height : '140dp',
        layout : 'vertical',
        backgroundColor : 'blue'
    });
    container.add(rightview);
 
    win.add(container);
    win.open();
and the result is this:

foto

but the expected result is

foto

Thanks a lot! :)


Viewing all articles
Browse latest Browse all 7655

Trending Articles



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