目标效果:
当鼠标按下左键在模拟器中移动,可以让图片跟着鼠标移动。
1.将activity_main.xml页面布局定义为FrameLayout帧布局,帧布局的特点就是控件默认位置都是在左上角。
activity_main.xml页面:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/layout_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:c