【问题标题】:android make my LinearLayout zoomableandroid 让我的 LinearLayout 可缩放
【发布时间】:2016-12-15 03:12:47
【问题描述】:

我有一个 LinearLayout,包裹在 ScrollView 中,其中主要包含 TextViews,有时包含 ImageViews。现在我想给用户用两根手指放大(和再次缩小)的可能性。有没有简单的方法可以做到这一点?这是 xml 文件的摘录:

<ScrollView
    android:background="@color/transparent"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="top">

    <LinearLayout
        android:background="@color/transparent"
        android:id="@+id/layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:layout_gravity="top|center_horizontal"></LinearLayout>
</ScrollView>

【问题讨论】:

标签: android android-layout


【解决方案1】:

使用 ZoomView

它将提供通过捏缩放布局的功能。

ZoomView zoomView = new ZoomView(this);
zoomView.addView(layout);

【讨论】:

  • 嗯,我对图书馆非常谨慎,因为该应用程序将在 google play 商店出售,而且我不太了解许可证。如果我使用它,我该怎么办?我阅读了 license.txt,但不太了解它
  • 它是免费使用的,我也在我的一个直播应用中使用过它
  • 好的,但我不能让它与ScrollView 一起很好地工作。如果我将Zoomview 放在ScrollView 内,它不会缩放到正确的位置,而是在下方某个位置。如果我将ScrollView 放在ZoomView 内,它会正确缩放,但滚动无法正常工作
  • 是的,我记得我没有将它与任何具有滚动行为的视图一起使用。
猜你喜欢
  • 2016-11-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-11-29
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多