首页 > 解决方案 > 二次采样比例图像视图

问题描述

有谁知道我们如何将一组图像发送到“ SubsamplingScaleImageView ”类...它适用于一个,但是...我只想打开 3 或 4 个图像并在它们之间滑动,我只是可以'找不到路...

任何帮助都会很棒!

这是我的(简单)代码:

主要活动:

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));
}

活动主.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>

谢谢!

标签: android

解决方案


推荐阅读