Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

can you reposition a view without using an animation?

is it possible to set top, left or center.x and center.y on a view, after it has already been created in a specific location? it's not working for me; the only thing working is to use an animation with a duration of 0. however, sometimes, there is a flicker.

example code:
view1.center.x = view2.center.x; view1.center.y = view2.center.y;


view1.animate({center:{x:view2.center.x, y:view2.center.y}, curve:Ti.UI.ANIMATION_CURVE_LINEAR, duration:0});

— asked September 28th 2010 by dave vanderkloot
  • imageview
  • position
  • view

2 Answers

  • yes.

    it won't animate when activated, but all you have to do is call it:

    button1.addEventListener('click', function() {
      view1.top = 5;
      view1.left = 10; 
    — answered April 9th 2012 by Vince Baskerville
  • I don't know if it will work on a view (I don't see why not) but as an experiment I successfully animated a Button just using a for loop to alter the button's 'top' value.


    — answered June 19th 2012 by Robin Williams
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.