I have a 1500x1500px image and i set it as android:background
and set layout width and height as 1500px
in FrameLayout
.
I want to see the whole image but I can only see a part of it because I cannot swipe to see the whole. I set the image as background so I can put buttons on the image.
How to view a background image beyond the phone's screen size?
MainActivity.java
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Bitmap bmp = BitmapFactory.decodeResource(this.getResources(),
R.drawable.finalmap);
ImageView imageView = new ScrollableImageView(this);// or find it by id
android.view.ViewGroup.LayoutParams layoutParams = imageView.getLayoutParams();
layoutParams.width = bmp.getWidth();
layoutParams.height = bmp.getHeight();
imageView.setLayoutParams(layoutParams);
}