简体   繁体   English

如何在我的LinearLayout中移动视图?

[英]How to move a View in my LinearLayout?

I have a linear layout and small view (50px - 50px), all I want to do is to move this view in to the parent (linear layout in my case). 我有一个线性布局和一个小视图(50px-50px),我要做的就是将该视图移到父视图(在我的情况下为线性布局)。 It doesn't have to be linear layout but if possible I want my wrapper to be linear layout. 它不一定是线性布局,但如果可能的话,我希望包装器是线性布局。 在此处输入图片说明

What is the right way to move a drawable in the parent ? 在父级中移动可绘制对象的正确方法是什么? my small green view is an image (R.drawable.myimage) and I want to be able to easily move this image in the parent, the movement should me smooth 我小的绿色视图是图像(R.drawable.myimage),我希望能够轻松地在父级中移动此图像,该移动应该使我平滑

The easiest solution is the built-in TranslateAnimation . 最简单的解决方案是内置的TranslateAnimation

If you're moving in straight lines, it works fine. 如果您直线移动,则效果很好。

You may need to be more specific about your needs: when will it animate? 您可能需要更具体地说明自己的需求:何时可以制作动画? What types of paths will it follow? 它会遵循哪种类型的路径?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM