简体   繁体   English

Android拖放,布局无限

[英]Android drag and drop, endless layout

I want a screen to arrange rectangles with drag & drop. 我希望屏幕通过拖放来排列矩形。 Elements can be moved freely, so it's not a grid or list. 元素可以自由移动,因此它不是网格或列表。 I think I should use absolute positions. 我认为我应该使用绝对职位。

My main problem is that I need an endless screen (when drag to right, scroll the screen to the right). 我的主要问题是我需要一个无尽的屏幕(向右拖动时,将屏幕向右滚动)。 One solution I found was to set width and height to 10000dp and a 2d scroll. 我发现的一个解决方案是将width和height设置为10000dp并使用2d滚动。 Another way is to resize the container each time the user drags an element. 另一种方法是在用户每次拖动元素时调整容器的大小。

I need a better solution if possible. 如果可能,我需要一个更好的解决方案。 Any suggestions? 有什么建议么?

范例图片

Resize the container each time the user drags an element out of the current view bounds should be the most performant idea. 每次用户将元素拖出当前视图范围时,调整容器的大小应该是最有效的主意。

By the way you should put some max size limit to the view, otherwise you will run out of RAM fast and your app will crash. 顺便说一句,您应该为视图设置一些最大大小限制,否则您将很快用完RAM,并且应用程序将崩溃。

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

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