戢翔 2020-11-18 12:41 采纳率: 0%
浏览 24

ScrollView缩放后无法滚动预览全视图

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/scaleScrollView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >

    <LinearLayout
        android:id="@+id/scaleLinearLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:scaleX="2"
        android:scaleY="2">

            <ImageView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="10dp"
                android:adjustViewBounds="true"
                android:scaleType="fitXY"
                android:src="@mipmap/p1" />

            <ImageView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="10dp"
                android:adjustViewBounds="true"
                android:scaleType="fitXY"
                android:src="@mipmap/p2" />
    </LinearLayout>
</ScrollView>

运行效果如图,我的目的是想放大后,让两张图片能够滚动可以查看全完整的图片。但是放大后,大部分都被遮住了。请问大神如何设置才能让滚动条随着布局放大而放大呢?刚开始接触移动端,新手不太熟,望指教。

  • 写回答

1条回答 默认 最新

  • 中控易动 企业官方账号 2020-11-18 14:30
    关注

    建议换种思路,你这样做的话不仅竖着需要滑动,横向同样需要滑动,建议用自定义imageview,改成手势缩放图片。

    示例:https://www.jianshu.com/p/7ce081a1bbf9

    评论

报告相同问题?