【问题标题】:Android Zoom In AnimationAndroid 放大动画
【发布时间】:2020-02-13 21:17:26
【问题描述】:

当我使用动画放大 PDF 视图时,我无法通过捏合缩放来缩小,当我不使用动画时,我可以通过捏合缩放轻松放大和缩小。我看不出问题,有没有一些代码可以模拟捏缩放到某些 X 和 Y 值?

我的缩放 xml 文件

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" android:fillAfter="true">
    <scale
        android:duration="600"
        android:fromXScale="1"
        android:fromYScale="1"
        android:pivotX="50%"
        android:pivotY="50%"
        android:toXScale="3"
        android:toYScale="3"/>
</set>

【问题讨论】:

  • 显示你的java代码
  • 不重要,我在导航图中使用动画app:enterAnim="@anim/zoom_in"

标签: android zooming pinchzoom


【解决方案1】:

像这样写zoom_out.xml文件,

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <scale
        android:duration="1000"
        android:fromXScale="1.0"
        android:fromYScale="1.0"
        android:pivotX="50%"
        android:pivotY="50%"
        android:toXScale=".2"
        android:toYScale=".2" />
</set>

和zoom_in.xml文件,如,

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <scale
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:duration="600"
        android:fromXScale="2"
        android:fromYScale="2"
        android:pivotX="50%"
        android:pivotY="50%"
        android:toXScale="4"
        android:toYScale="4" >
    </scale>
</set>

【讨论】:

  • 这只是将我的视图返回到其默认值,因为它没有 android:fillAfter="true" 值。我想保持这样,但也让我捏缩小它..
猜你喜欢
  • 1970-01-01
  • 2011-07-07
  • 1970-01-01
  • 1970-01-01
  • 2016-11-15
  • 2011-10-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多