【问题标题】:making a view move from one coordinate to another coordinate in android studio在android studio中使视图从一个坐标移动到另一个坐标
【发布时间】:2021-09-30 05:14:56
【问题描述】:

我在 android studio 中有一个图像视图和一个照片视图。 photoview 设置为图像位图。我想最初在 photoview 顶部的特定 x、y 坐标上放置一个视图,但我想根据图像位图的矩阵而不是 photoview 放置视图。然后我想让图像视图从 1 x, y 坐标转换为另一个坐标。最好的方法是什么?

【问题讨论】:

  • 请提供足够的代码,以便其他人更好地理解或重现问题。

标签: android android-studio animation imageview


【解决方案1】:

您的问题有点含糊,但查看问题的标题,要将视图移动到另一个视图的坐标,您可以将 x 和 y 设置为要移动到的视图的值。假设您要将 imagview1 移动到 imageview2 所在的位置:

imageview1.animate().x(imageview2.getX()).y(imageview2.getY());

或者,如果您不想为其设置动画,只需删除 animate():

imageview1.setX(imageview2.getX());```

Could you elaborate more or in this case, clearly

【讨论】:

    猜你喜欢
    • 2013-03-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-16
    • 1970-01-01
    • 1970-01-01
    • 2020-09-09
    相关资源
    最近更新 更多