Java Android ZoomableRelativeLayout问题

Java Android ZoomableRelativeLayout问题,java,android,android-relativelayout,Java,Android,Android Relativelayout,我正在使用类在我的应用程序中添加一个可缩放的相对布局。我的布局是这样的 <com.example.zoomablerelativelayoutexample.ZoomableRelativeLayout android:layout_width="500dp" android:layout_height="500dp" android:layout_alignParentTop="true" android:background="#000" >

我正在使用类在我的应用程序中添加一个可缩放的相对布局。我的布局是这样的

<com.example.zoomablerelativelayoutexample.ZoomableRelativeLayout
    android:layout_width="500dp"
    android:layout_height="500dp"
    android:layout_alignParentTop="true"
    android:background="#000" >

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_marginBottom="124dp"
        android:layout_marginLeft="64dp"
        android:layout_toRightOf="@+id/imageButton1"
        android:src="@drawable/ic_launcher" />

    <ImageButton
        android:id="@+id/imageButton1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:layout_marginRight="52dp"
        android:layout_marginTop="131dp"
        android:src="@drawable/ic_launcher" />

</com.example.zoomablerelativelayoutexample.ZoomableRelativeLayout>


这是主xml的屏幕截图

问题是这个,;当我在相对论中进行收缩缩放时,你会正常缩放。当我移动布局时进行缩放后,它会无休止地移动


我想用边界限制移动事件。我该怎么做?

请在这里查看我的答案--