【问题标题】:Scrollview zoom not scrolling left and right滚动视图缩放不左右滚动
【发布时间】:2015-05-08 19:11:18
【问题描述】:

我正在尝试使 ScrollView 可以在 post 之后进行缩放

 mScaleDetector = new ScaleGestureDetector(context,
     new ScaleGestureDetector.SimpleOnScaleGestureListener() {
     @Override
     public boolean onScale(ScaleGestureDetector detector) {
     float scale = 1 - detector.getScaleFactor();

     float prevScale = mScale;
     mScale += scale;

     if (mScale < 0.1f) // Minimum scale condition:
     mScale = 0.1f;

     if (mScale > 10f) // Maximum scale condition:
     mScale = 10f;
     ScaleAnimation scaleAnimation = new ScaleAnimation(
     1f / prevScale, 1f / mScale, 1f / prevScale,
     1f / mScale, detector.getFocusX(),
     detector.getFocusY());
     scaleAnimation.setDuration(0);
     scaleAnimation.setFillAfter(true);

     startAnimation(scaleAnimation);
     return true;
     }


     });

但是缩放滚动只能上下滚动,我也在尝试让它左右滚动。

【问题讨论】:

    标签: android scrollview pinchzoom


    【解决方案1】:

    Scrollview 只做垂直滚动,而 Horizo​​ntalScrollView 做水平滚动。

    没有类(AFAIK)启用滚动两个轴,您可以在互联网上找到该类或编写您自己的类。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-10-05
      • 1970-01-01
      • 2020-02-11
      • 1970-01-01
      • 1970-01-01
      • 2019-06-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多