里面RelativeLayout的安卓移动的ImageView [英] Move ImageView inside RelativeLayout Android
本文介绍了里面RelativeLayout的安卓移动的ImageView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经与Android的ImageView的:scaleType =矩阵
I have An imageView with 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" />
我想拖这个的ImageView
向左看图像的部分它是关闭屏幕。
I want to drag this ImageView
to left to look at the parts of image which were off screen.
在换句话说,我想提出这个形象,我在纪念的ImageView
。
In other words I want to move this image to the point where I mark the point on ImageView
.
请帮忙。谢谢
推荐答案
把你的ImageView内的FrameLayout和使用以下code键移动它:
Put your Imageview Inside Framelayout and use following code to move it :
Java的code:
Java Code:
_frameLayout.setX(Position);
_frameLayout.setY(Position);
示例XML:
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>
这篇关于里面RelativeLayout的安卓移动的ImageView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文