Move ImageView inside RelativeLayout Android -
i have imageview android:scaletype="matrix"
<imageview android:id="@+id/imageview" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_below="@+id/textview1" android:layout_margintop="20dp" android:scaletype="matrix" android:src="@drawable/ic_launcher" />
i want drag imageview
left @ parts of image off screen.
in other words want move image point mark point on imageview
.
please help.
put imageview inside framelayout , use following code move :
java code:
_framelayout.setx(position); _framelayout.sety(position);
example xml :
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/background_material_dark" > <imageview android:layout_width="match_parent" android:layout_height="200dp" android:background="@drawable/ic_launcher"/> <framelayout android:id="@+id/framelayout" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margintop="40dp" android:background="#ffffff" > <relativelayout android:layout_width="match_parent" android:layout_height="wrap_content" > <imageview android:id="@+id/img" android:layout_width="110dp" android:layout_height="200dp" android:layout_centerhorizontal="true" android:background="@drawable/ic_launcher" /> </relativelayout> </framelayout>
Comments
Post a Comment