I would like to know how can I keep my relative layout fixed. I have a relative layout inside that I have an image view. I am also adding custom views to my relative layout. But when I move my custom views the relative layout height increases.
I want the custom view to get cut if it goes out of the bound of my relative layout.
Below is my relative layout
<RelativeLayout
android:id="@+id/relativelayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@android:color/holo_blue_light" >
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:contentDescription="@string/content_description"
android:src="@drawable/img" />
</RelativeLayout>
Below is the code where I am moving my custom view
relativeLayoutParams.leftMargin += dx;
relativeLayoutParams.topMargin += dy;
v.setLayoutParams(relativeLayoutParams);
v.invalidate();