0

I have an image in my application. But size of the image becomes larger for smaller screens. So I tried by adding scroll view for the image.

Code:

<ScrollView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:scrollbarFadeDuration="10"
    android:scrollbarAlwaysDrawHorizontalTrack="true"
    android:scrollbarAlwaysDrawVerticalTrack="true" >

<ImageView
    android:id="@+id/imageView1"
    android:layout_width="400dp"
    android:layout_height="500dp"
    android:contentDescription="@string/image"
    android:layout_marginLeft="160dp"
    android:scrollbarThumbHorizontal="@id/imageView1"
    android:scrollbarThumbVertical="@id/imageView1"
    android:src="@drawable/abc" />

</ScrollView>

But this allows me to scroll in vertical direction only. Help me what do so that I can scroll the image in horizontal direction also.

nomorequestions
  • 589
  • 2
  • 6
  • 20

2 Answers2

0

A simple solution might be to scale the image to fit the the screen using scaleType. To include horizontal/vertical scrolling, take a look at this post.

Community
  • 1
  • 1
Tadej
  • 2,901
  • 1
  • 17
  • 23
0

You can use TouchImageView. This project adds touch functionality to android imageView. Scroll, pinchzoom etc.