android 布局缩放,在viewpager内部的Android缩放到缩放布局,左右填充

我有一个带有左右填充的viewpager,用于显示viewpager左右页面的预览.

viewPager.setPadding(30,0,30,0);

viewpager的内容是从here借来的zoomlayout.

所以问题是,每当我从viewpager缩放布局时,唯一可见的缩放位于顶部和底部.由于填充,左右不可见变焦.

缩放前的屏幕截图

PqdMr.jpg

缩放后的屏幕截图

e9d3586ff991e921eb6e2d5d0456880e.png

7bbb33ba4690381e7fcc579aaf35a82b.png

缩放视图在viewpager填充内限制.我需要视图来缩放全屏而没有任何填充或边界.

这些是我正在尝试的代码片段

activity_reader.xml

xmlns:android="http://schemas.android.com/apk/res/android"

xmlns:app="http://schemas.android.com/apk/res-auto"

xmlns:tools="http://schemas.android.com/tools"

android:layout_width="match_parent"

android:layout_height="match_parent">

android:id="@+id/reader_pager"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:background="#000"/>

each_page.xml

xmlns:android="http://schemas.android.com/apk/res/android"

xmlns:app="http://schemas.android.com/apk/res-auto"

xmlns:tools="http://schemas.android.com/tools"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:id="@+id/zoom_layout">

android:id="@+id/img_holder"

android:transitionName="pager"

android:background="#FFF"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_gravity="center"

android:orientation="vertical">

android:id="@+id/page_image"

android:layout_width="match_parent"

android:layout_height="wrap_content"

app:srcCompat="@drawable/a_four"

android:layout_weight="1"

android:scaleType="fitXY"

/>

在缩放视图后,当我松开手指时,视图应该平滑移动到全屏视图戳.

尝试将clipToPadding设置为false,但在缩放时仍然存在填充的一侧

解决方法:

您是否尝试在viewlay中将zoomview放在framelayout中(不在每个页面中),因此它位于viewpager之上.

标签:pinchzoom,android,android-viewpager,zoom,scale

来源: https://codeday.me/bug/20191008/1873555.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值