Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/356.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/209.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在第一个TouchImageView的setOnTouchImageViewListener事件上缩放第二个TouchImageView?_Java_Android - Fatal编程技术网

Java 如何在第一个TouchImageView的setOnTouchImageViewListener事件上缩放第二个TouchImageView?

Java 如何在第一个TouchImageView的setOnTouchImageViewListener事件上缩放第二个TouchImageView?,java,android,Java,Android,我有两张照片。我想做的是,当我放大第一个TouchImageView时,第二个也会自动放大。当我在第一个TouchImageView上从左向右或从右向左滑动时,第二个也需要自动滑动,但顺序相反。i、 e如果我从左向右滑动第一个TouchImageView,则需要从右向左自动滑动第二个TouchImageView。我正在使用TouchImageView类。我的代码如下。提前谢谢 activity_main.xml <LinearLayout xmlns:android="http:/

我有两张照片。我想做的是,当我放大第一个TouchImageView时,第二个也会自动放大。当我在第一个TouchImageView上从左向右或从右向左滑动时,第二个也需要自动滑动,但顺序相反。i、 e如果我从左向右滑动第一个TouchImageView,则需要从右向左自动滑动第二个TouchImageView。我正在使用TouchImageView类。我的代码如下。提前谢谢

activity_main.xml

    <LinearLayout 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:gravity="center"
    android:orientation="horizontal"
    android:weightSum="2"
    tools:context="com.PinchZoom.pinchzoomexampletwo.MainActivity" >

    <com.PinchZoom.pinchzoomexampletwo.TouchImageView
        android:id="@+id/img_to_be_zoomed"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_weight="1"
        android:src="@drawable/fb" >
    </com.PinchZoom.pinchzoomexampletwo.TouchImageView>


    <com.PinchZoom.pinchzoomexampletwo.TouchImageView
        android:id="@+id/img_to_be_zoomed_mirror"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_weight="1"
        android:src="@drawable/fb" >
    </com.PinchZoom.pinchzoomexampletwo.TouchImageView>


</LinearLayout>
TouchImageView.java

我已经实现了它的缩放,但没有得到的刷卡

    package com.PinchZoom.pinchzoomexampletwo;

import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;

import com.PinchZoom.pinchzoomexampletwo.TouchImageView.OnTouchImageViewListener;

public class MainActivity extends ActionBarActivity {
    TouchImageView img_to_be_zoomed;
    TouchImageView img_to_be_zoomed_mirror;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        img_to_be_zoomed_mirror = (TouchImageView) findViewById(R.id.img_to_be_zoomed_mirror);
        img_to_be_zoomed = (TouchImageView) findViewById(R.id.img_to_be_zoomed);
        img_to_be_zoomed
                .setOnTouchImageViewListener(new OnTouchImageViewListener() {

                    @Override
                    public void onMove() {
                        img_to_be_zoomed_mirror.setZoom(img_to_be_zoomed
                                .getCurrentZoom());
                        img_to_be_zoomed_mirror.setScrollPosition(
                                img_to_be_zoomed.getScaleX(), 0);
                        Log.e("Left Img X: ", "" + img_to_be_zoomed.getScaleX());
                    }
                });
    }
}