简体   繁体   English

Android Pinch使用ScrollView缩放ImageView(PhotoView)

[英]Android Pinch Zoom ImageView (PhotoView) with ScrollView

I have the following layout in android where I basically have an image view with a composite caption consisted of other imageviews+textviews: 我在android中有以下布局,其中我基本上有一个图像视图,其复合标题由其他图像视图+ textviews组成:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content">

    <RelativeLayout
            android:id="@+id/imagePager_container"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

        <uk.co.senab.photoview.PhotoView
                android:id="@+id/imagePager_imageView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"/>

        <TextView
                android:id="@+id/imagePager_textTitle"
                android:layout_width="fill_parent"
                android:gravity="center"
                android:textStyle="bold"
                android:text="TITLE"
                android:layout_margin="0dp"
                android:layout_below="@+id/imagePager_imageView"
                android:layout_height="wrap_content"/>

        <ImageView android:id="@+id/imagePager_titleLine"
                   android:layout_width="fill_parent"
                   android:layout_below="@+id/imagePager_textTitle"
                   android:layout_height="match_parent"
                   android:paddingLeft="5dp"
                   android:paddingRight="5dp"
                   android:src="@drawable/linebig"/>

        <TextView
                android:id="@+id/imagePager_textSubtitle"
                android:layout_width="fill_parent"
                android:gravity="center"
                android:text="SUBTITLE"
                android:layout_margin="0dp"
                android:layout_below="@+id/imagePager_titleLine"
                android:layout_height="wrap_content"/>

        <ImageView android:id="@+id/imagePager_subtitleLine"
                   android:layout_below="@+id/imagePager_textSubtitle"
                   android:layout_width="fill_parent"
                   android:layout_height="match_parent"
                   android:paddingLeft="30dp"
                   android:paddingRight="30dp"
                   android:paddingBottom="10dp"
                   android:src="@drawable/linebig"/>

        <TextView
                android:id="@+id/imagePager_textContent"
                android:layout_width="fill_parent"
                android:paddingTop="15dp"
                android:paddingLeft="20dp"
                android:paddingRight="20dp"
                android:text="CONTENT"
                android:layout_margin="0dp"
                android:layout_below="@+id/imagePager_subtitleLine"
                android:layout_height="wrap_content"/>


    </RelativeLayout>
</ScrollView>

The issue is that if the entire content is so "long" that the ScrollView is enabled then Pinch Zoom doesnt work. 问题是,如果整个内容如此“长”以致ScrollView已启用,则Pinch Zoom不起作用。 Else it works perfectly. 否则它完美无缺。 I guess the ScrollView listeners considers the "Pinch" and up/down motion. 我想ScrollView听众会考虑“捏合”和上/下动作。 Anyone have a solution for this? 有人有解决方案吗?

将您的scrollview更改为android.support.v4.widget.NestedScrollView

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM