Display image larger than device screen

I would like to display a larger image than the device screen without resizing the image. It should be focused on the screen. How can i do this?

+6
source share
4 answers

use scrollview with image and set the height of this scroll.

Example

<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> 
+6
source

I noticed that for scrolling in both directions I need to use a regular (vertical) and horizontal ScrollView. Please tell me 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> 

He began to display the form in the upper left corner of the image. If I tried to use android: layout_gravity = "center", then I got the white part on the right or bottom. Therefore, centering does not work for me.

Option 2: Use a WebView control and load it with an onCreate image.

+3
source

Withdraw from the view, overwrite onDraw and draw it on the screen.

0
source

You can also work with framelayout. The layout may be larger than the screen.

0
source

Source: https://habr.com/ru/post/891185/


All Articles