Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8071765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T13:47:58+00:00 2026-06-05T13:47:58+00:00

I need to be able to display an image with zoom and scroll capabilities.

  • 0

I need to be able to display an image with zoom and scroll capabilities. Since this seems a bit too tedious with ImageView, I’m doing it with a WebView which loads the local image and then displays it. This is my current code:

    WebView image = (WebView)findViewById(R.id.image);
    image.getSettings().setBuiltInZoomControls(true);
    image.getSettings().setLoadWithOverviewMode(true);
    image.getSettings().setUseWideViewPort(true);
    image.setInitialScale(40);
    image.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT));
    image.loadUrl("file:///android_asset/image.png");

While this loads the image, I can’t get it to display only the image. There is always a decent amount of white space below it since setUseWideViewPort(true) makes it go all the way out to scale the width.

Any suggestions on allowing it to only scroll over the image that is loaded? Thanks. I’ve also tried setDefaultZoom and can’t get it to go out far enough.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T13:48:02+00:00Added an answer on June 5, 2026 at 1:48 pm

    I think using a static percentage 40 within your setInitialScale method is decent, however, it does not take into consideration screen density or size per say. Currently your 40 means that you are scaled to 40% of the actual size.

    Think about when you open up an image only in your web browser on your PC, this is going to essentially respond the same way, put it in the upper left corner. Yes you can scale it with a WebView, but in this case to make it work for all platforms you are going to have to calculated your scaling factor based upon the screen resolution minus any bounding rectangle (top and bottom in the Android’ case) related to the actual width and height of the image.

    I suggest you go back to the ImageView!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to be able to display ads on email forwarded through a server
I need to be able to display data that I have in 15 minute
I need to be able to display a money field as $XX,XXX.XX, but without
I need to be able to display a set of 1200 random combinations out
I need to display an image in an S-Control is SFDC. I would like
I need to display a pretty image of a map of Europe, and I
I am attempting to implement a custom view. This view should display an image
I am trying to display an image with canvas that allows zoom and panning
I am using Umbraco and I need to display an image in a Rss
Users of the website need to able to store images in their area ,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.