I'd like to display an image larger, in size, than a device's screen without resizing the image. It has to be centered on the screen. How can I do this?
use scrollview with image view and set height of that scroll view
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:id="@+id/accountIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</ScrollView>
I noticed that I need to use normal (vertical) and horizontal ScrollView in order to scroll both directions. Let me know please if there is another way.
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/scrollView" >
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/horizontalScrollView">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/imageView3"
android:src="@drawable/big_map"/>
</HorizontalScrollView>
</ScrollView>
It started display form left upper corner of the image. If I tried to use android:layout_gravity="center" then I got white part on right or bottom. So centering is not working for me.
Option 2: use WebView control, and load it with image onCreate.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With