更改Titanium上的视图坐标

时间:2015-04-15 03:10:18

标签: animation view titanium coordinates

钛合金动画不会改变视图的坐标。那么更改视图坐标(例如顶部)然后跟踪它的位置的最佳方法是什么。

var t1 = Ti.UI.create2DMatrix();
var a1 = Ti.UI.createAnimation();
t1 = t1.translate(0, 10);//Translate on y coordinate
a1.transform = t1;
a1.duration = 800;
view.animate(a1); // Move the view, but the top property keeps the same

谢谢,对不起,如果这是一个愚蠢的问题!!

1 个答案:

答案 0 :(得分:0)

animate()方法不会因为原因改变任何坐标。

布局机制需要

topleftrightbottom

更改顶部坐标的最简单方法是将其设置为这样。

 $.getView().applyProperties({
    top: newTopValue
});

设置后,它会自动触发布局重新计算