二次采样比例图像视图

时间:2018-07-09 21:40:06

标签: android

有人知道如何将图像数组发送到' SubsamplingScaleImageView '类... 它可以正常工作,但是...我只想打开3或4张图像,然后在它们之间滑动,就找不到办法...

任何帮助都会很棒!

这是我的(简单)代码:

MainActivity:

private int[] myImages;

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

    myImages = new int[]{
            R.drawable.p01, R.drawable.p02
    };

    SubsamplingScaleImageView imageView = (SubsamplingScaleImageView)findViewById(R.id.imageView);
    imageView.setImage(ImageSource.resource(R.drawable.p01));
}

activity_main.xml:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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"
    tools:context=".MainActivity">

    <com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
        android:id="@+id/imageView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

</android.support.constraint.ConstraintLayout>

谢谢!

0 个答案:

没有答案