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.
我可以覆盖 onTouchEvent,但在 EditText 或普通视图中没有要设置的 x 和 y 坐标。
您将需要将任何容器(例如,RelativeLayout)的规则调整为将小部件保存为您希望它成为的任何内容,因为onTouchEvent(). 通常,这是通过调整LayoutParams与正在移动的小部件关联的特定容器来实现的。
RelativeLayout
onTouchEvent()
LayoutParams