My android app contains a map that the user should scroll horizontally and vertically to see all of it. I've used two horizontal and vertical scroll view, and the image view is in it. But the problem is that, the picture isn't shown completely in the layout and a part of the top margin and left margin are hidden(cut). so my question is:
- How to show the picture completely in the scroll view without cutting the margins?The problem is shown is this picture
- when I start the application at first the image in the scroll view is not scaled! and after a touch event gets bigger at its size.
code:
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="100dp"
android:layout_marginTop="150dp"
android:scrollbarStyle="outsideOverlay"
>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center"
android:gravity="center">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbarStyle="outsideOverlay">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_gravity="center"
android:gravity="center">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@android:drawable/ic_input_add"
android:id="@+id/imageView2"
android:gravity="center_vertical|center_horizontal"
/>
</RelativeLayout>
</ScrollView>
</RelativeLayout>
</HorizontalScrollView>