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

  • Home
  • SEARCH
  • 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 6712609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:16:46+00:00 2026-05-26T08:16:46+00:00

I have a bitmap and I draw it like this : bit = BitmapFactory.decodeResource(getResources(),

  • 0

I have a bitmap and I draw it like this :

bit = BitmapFactory.decodeResource(getResources(),
                   R.drawable.anim_ctrl_panel);
Paint paint = new Paint();
canvas.drawBitmap(bit, 80, 440, paint);

The problem is that the image is set as fullscreen .On onTouchEvent method I implement the event for the bitmap and anywhere I select screen the event is implement. I want the image to have a certain position and only for that position to be implement the event. How can I do this?

EDIT: the problem was at onTouchEvent method. This is the solution :

public boolean onTouchEvent(MotionEvent event) {if(80 <= event.getX() && event.getX()<= (80+bit.getWidth()/2) && (440 <= event.getY() && (event.getY() <= 440+bit.getHeight()))){   
            //...
        }else if((80+bit.getWidth()/2) <= event.getX() && event.getX()<= (80+bit.getWidth()) && (440 <= event.getY() && (event.getY() <= 440+bit.getHeight()))){
            //...
            }

this help me : How can I check the Image is Touched using OnTouch()

  • 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-26T08:16:47+00:00Added an answer on May 26, 2026 at 8:16 am

    For Image set in particular area, I think Rectangle is useful for this,

    Something like this, (In my case Its work for me)

    Canvas canvas = new Canvas(bitmap);
    final Paint paint = new Paint();         
    final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());         
    paint.setAntiAlias(true);         
    canvas.drawARGB(0, 0, 0, 0);         
    canvas.drawBitmap(bitmap, rect, rect, paint);
    

    Try it.

    For more info look at Android – Drawing (Core)

    Thanks.

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

Sidebar

Related Questions

I'd like to draw antialiased text on a transparent bitmap and have the antialiasing
I have a Canvas that i draw text on. (this is quite advanced i
I have a bitmap object and draw some curves on it by setpixel method.
I have a Format32bppArgb backbuffer, where I draw some lines: var g = Graphics.FromImage(bitmap);
I have a bitmap image context and want to let this appear blurry. So
I have a 2D bitmap-like array of let's say 500*500 values. I'm trying to
While I have made a topic like this in the past, this is from
I have a picture (bitmap) and I want to draw some shapes and rotated
I have to draw a bitmap multiple times. It's loaded from file. I can
I have a c#-class that looks roughly like this: class ImageContainer { Image image;

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.