横向缩放图像

时间:2018-07-05 00:29:10

标签: android image imageview

我在循环视图中加载了一组漫画页面,在旋转到横向时,图像将不会填满屏幕,如果将比例类型设置为合适,图像将被拉伸并且纵横比关闭。与其他漫画或漫画读者一样,如何使图像适合风景呢?

这是我的图片视图

<com.github.chrisbanes.photoview.PhotoView
    android:id="@+id/page_display"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:visibility="gone"
    android:adjustViewBounds="true"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

在这里我在recyclerview中加载图像

GlideApp.with(mContext)
                .load(storageRef.child(mChapters.getComicTitle() + "/Chapter " +
                        mChapters.getChapterNumber() + "/" + currentPage.getPageImage()))
                .listener(new RequestListener<Drawable>() {
                    @Override
                    public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
                        ((ComicReaderHolder) holder).loadingPageImage.setVisibility(View.GONE);
                        return false;
                    }

                    @Override
                    public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
                        ((ComicReaderHolder) holder).loadingPageImage.setVisibility(View.GONE);
                        return false;
                    }
                })
                .into(((ComicReaderHolder) holder).pageImage);

0 个答案:

没有答案