0

i have a LinearLayout, wrapped in a ScrollView, that contains mostly TextViews and sometimes ImageViews. Now i want to give the user the possibility to zoom in(and out again) with two fingers. Is there an easy way to do that? Here is the extract from the xml-file:

<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>
Ginso
  • 459
  • 17
  • 33
  • Possible duplicate of http://stackoverflow.com/a/15850113/5515371 – Mujammil Ahamed Aug 09 '16 at 07:25
  • 3
    Possible duplicate of [How to make zoomable LinearLayout?](http://stackoverflow.com/questions/15849060/how-to-make-zoomable-linearlayout) – Fajar Khan Aug 09 '16 at 07:31
  • hmm i'm very cautious with libraries, since the app will be sold in google play store and i don't understand much of licenses. What would i have to do if i use that? i read the license.txt, but didn't understand much of it – Ginso Aug 09 '16 at 08:10

1 Answers1

1

Use ZoomView

It will provide functionality to zoom layout by pinch.

ZoomView zoomView = new ZoomView(this);
zoomView.addView(layout);
User
  • 4,023
  • 4
  • 37
  • 63
  • hmm i'm very cautious with libraries, since the app will be sold in google play store and i don't understand much of licenses. What would i have to do if i use that? i read the license.txt, but didn't understand much of it – Ginso Aug 09 '16 at 08:10
  • It is free to use, I've also used it in one of my live apps – User Aug 09 '16 at 08:49
  • ok, but i don't get it to work nicely with `ScrollView` together. If i put the `Zoomview` inside the `ScrollView`, it doesn't zoom to right position, but somewhere below. If i put the `ScrollView` inside the `ZoomView` it zooms correct but scrolling doesn't work right – Ginso Aug 09 '16 at 09:28
  • Yeah I remember that I haven't used it with any view with scroll behavior. – User Aug 09 '16 at 09:49