移动视图本身动画的结束位置 [英] Move view itself to animation's end position

查看:144
本文介绍了移动视图本身动画的结束位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个真正严重的问题。
我想在这里实现一些观点是在屏幕上移动的用户界面,用户可以触摸它。
我知道,常规API-1动画框架举措的观点只是图形和API-11动画框架移动视图本身,但问题是,它仅支持API-11 +,这是非常高的。

我认为外放点击监听器上的观点本身,而不是 - 我将确定单击了哪个项目通过获取其位置。
所以这是我会做什么:
*用户触摸屏幕。
*停止所有动画。
*获取所有到动画已结束的位置的动画意见。 (这是我需要你的帮助)。
*迭代的意见,看看点击是其中的一个领域。

但我不能找到一种方法来移动视图到动画的结束位置。

如果有人知道的方式,我会非常感激!

在此先感谢,
埃拉德


解决方案

  

但我不能找到一种方法来移动视图到动画的结束位置。


修改了的LayoutParams 将其移动到终点位置。使用 getLayoutParams()查看,将其转换为基于其容器上相应的类型,修改的LayoutParams 对象,然后调用 setLayoutParams()查看来犯变化。

I'm having a real serious problem. I want to implement UI where some view is moving on the screen and the user can touch it. I know that regular API-1 Animation framework move just the graphics of the view, and API-11 Animator framework move the view itself, but the problem is that it support only API-11+ which is very high.

I thought that instead of putting click listener on the view itself - I will identify which item was clicked by getting its position. So this is what I will do: * User touch the screen. * Stop all the animations. * Get all the animated views to the position where the animation was ended. (This is were I need your help). * Iterate over the views and find out if the click was in the area of one of them.

But I can't find a way to move the view to the animation's end position.

If someone knows a way, I will be very thankful!

Thanks in advance, Elad

解决方案

But I can't find a way to move the view to the animation's end position.

Modify its LayoutParams to move it to the end position. Use getLayoutParams() on the View, cast it to the appropriate type based on its container, modify the LayoutParams object, then call setLayoutParams() on the View to commit the changes.

这篇关于移动视图本身动画的结束位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆