Manuel_Rodrigues Manuel_Rodrigues - 1 year ago 79
Android Question

resize all objects inside view in titanium

I have a view that contains my layout . when a button is pressed the main view is resized but all it children keep the same height and width. How can I resize all objects that are inside the main view?

for example when I have this:

var view = Ti.UI.createView({


how can I for example resize the secunde view that is added to the firs one?

I'm developing my app in titanium in classic mode.

Answer Source

Because you specified SIZE as the size for a view it will keep that size. As you didn't specify it needed to have a size based on the parent.

The only way to do this is, if you specify the height and width as a percentage.

If your content is in fact dynamic you could trick it.

When the button is pressed convert your view to an image with var image = view.toImage().

Then, hide all the content you've added and insert the image into your view:

var image = view.toImage()

var img = Ti.UI.createImageView({
    height: '100%',
    width: '100%',
    image: image

Then you can resize your view and the content will resize too.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download