Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想做一个自定义工具栏,比如解锁安卓手机的幻灯片。在空闲状态下,用户可以看到页面左下方的一个按钮。然后用户点击它,向右拖动。当用户到达右端时,工具栏将“锁定”。按钮将位于工具栏上。
我正在考虑使用 customview 和 touchmoved 功能,但我不知道如何使视图随触摸移动,以及如何实际锁定栏。
每次您移动手指时,都会调用 touchmoved 函数。在 touchmoved 函数中,您必须重新绘制整个视图或为此视图设置一个新框架。这非常简单,因为您已经知道如何检测触摸并对其做出反应。