【问题标题】:Pinch-zoom image and scrollview - not behaves good together捏缩放图像和滚动视图 - 不能很好地结合在一起
【发布时间】:2016-02-25 21:22:49
【问题描述】:

我开发了一个图片库,可以在其中进行捏合和缩放。只需单击实际图像,即可将其加载到可以捏合和缩放的片段中。 这很好用!缩放的源代码是一个找到的库,并通过 xml 在代码中实现。

当我想到在可缩放图像下方放置一个文本并且当文本变长时,我必须将线性布局及其子元素包裹在滚动视图中时出现了问题。捏和缩放现在无法正常工作会发生什么 - 我可以像以前一样缩放和捏,但它有点慢并且不再平滑。

任何想法是什么原因,是否有任何简单的解决方案?可能很难将滚动视图与捏合缩放图像视图结合起来吗?

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_marginBottom="0sp" 
 android:layout_gravity="center"
 android:fillViewport="true"
 android:orientation="vertical">


<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textColor="#ffffff"
    android:orientation="vertical" >

  <se.sources.thai.TouchImageView
    android:id="@+id/text_img"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:adjustViewBounds="true"
    android:contentDescription="img1"/>

  <TextView
     android:id="@+id/text_img_text"
     style="@style/MyTextViewTheme" 
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     />


   </LinearLayout>
</ScrollView>

【问题讨论】:

    标签: android android-imageview android-scrollview pinchzoom


    【解决方案1】:

    试试这个库的捏缩放功能:https://github.com/chrisbanes/PhotoView

    正如“功能”中所说,它在滚动父级中完美运行。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-08-26
      • 2014-01-07
      • 2016-10-05
      • 1970-01-01
      • 2012-05-24
      • 2021-12-17
      • 2012-03-07
      相关资源
      最近更新 更多