Search code examples
androidlayouttitaniumfill-parent

Titanium mobile relative layout


I'm creating android app using Titanium mobile. How do I create this interface using vertical layout?

----------------
Header View        } height = 40dp
-----------------


 Content View      } height = fill_parent


----------------

In the official android sdk, we have fill_parent size to stretch the content view to bottom. Setting height to 'auto' will adjust the height according the height of the content; setting it to '100%' will covers the whole screen.

Been searching this answer for days, really appreciate your helps.

Edit: Another question, what if the header view was at bottom?

-----------------


 Content View      } height = fill_parent


----------------
 Header View        } height = 40dp
----------------

Solution

  • The content view should be like this (like you also can do it with HTML)

    var content_view = Ti.UI.createView({
        top: 40,
        bottom: 0
    });
    

    If the bar is at the bottom, just turn it around:

    var content_view = Ti.UI.createView({
        top: 0,
        bottom: 40
    });