android 可缩放的布局,Android pinch可缩放带有左右填充的viewpager内的布局

博客讨论了在Android中使用ViewPager时遇到的问题,即设置填充后,内容的缩放仅在顶部和底部可见,而左右两侧由于填充不可见。作者提供了XML布局代码,并希望在缩放后能平滑过渡到全屏显示页面。解决方案可能涉及到调整ViewPager或其子视图的缩放行为。
摘要由CSDN通过智能技术生成

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

viewpager的内容是从

here

.

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

缩放前的屏幕截图

PqdMr.jpg

e9d3586ff991e921eb6e2d5d0456880e.png

7bbb33ba4690381e7fcc579aaf35a82b.png

这些是我试过的代码片段

活动读取程序.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"/>

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"

/>

缩放视图后,当我松开手指时,视图应平滑地移动到全屏显示页面。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值