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 6601407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:44:55+00:00 2026-05-25T18:44:55+00:00

I want to add an image in my application which is like a road

  • 0

I want to add an image in my application which is like a road map image.
I want to add zooming features to this image as well as horizontal scrolling when the image is zoomed.

I have written some code but it allows only zooming and not scrolling.

Code:

public class Zoom extends View {
    private Drawable image;
    private int zoomControler=20;
    public Zoom(Context context)
    {
            super(context);
            image=context.getResources().getDrawable(R.drawable.boothmap);
            setFocusable(true);

    }
    protected void onDraw(Canvas canvas) {
            super.onDraw(canvas);
            image.setBounds((getWidth()/2)-zoomControler, (getHeight()/2)-zoomControler, (getWidth()/2)+zoomControler, (getHeight()/2)+zoomControler);
            image.draw(canvas);
    }
    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {

            if(keyCode==KeyEvent.KEYCODE_DPAD_UP)// zoom in
                    zoomControler+=10;
            if(keyCode==KeyEvent.KEYCODE_DPAD_DOWN) // zoom out
                    zoomControler-=10;
            if(zoomControler<10)
                    zoomControler=10;

            invalidate();
            return true;
    }
}

Can you help me solving this problem. Is my code proper so far or do you have any better code?

  • 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-05-25T18:44:56+00:00Added an answer on May 25, 2026 at 6:44 pm

    what worked for me is : just add built in zoom controls to webview and then call its loadDataWithBaseURL method.

    webview.getSettings().setBuiltInZoomControls(true);
    webview.loadDataWithBaseURL("file:///android_asset/", "<img src='file:///android_res/drawable/example.png' />", "text/html", "utf-8", null);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi an developing drawing android application. in that i want to add a sticker(image)
I want to add multiple borders on a single image. Is this possible through
I made an application which download lots of data and I want to add
I want to add line chart in my application , which has two view
Hi I want to add image in table cell according to condition in table.
I want to add an image, instead of the default button. I already have
I want to add background image to uinavigationcontroller. Please help me.
I want to add an image to be a background of the header, the
I want to add a background image to a bar chart using Highcharts and
I am very new to Java, I want to add a PNG image to

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.