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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:25:53+00:00 2026-05-26T07:25:53+00:00

I display an image using onDraw Method like this : public void onDraw(Canvas canvas)

  • 0

I display an image using onDraw Method like this :

public void onDraw(Canvas canvas) {
     super.onDraw(canvas);
     Bitmap background = BitmapFactory.decodeResource(getResources(), R.drawable.photo0);
     canvas.drawColor(Color.BLACK);
     canvas.drawBitmap(background, 0, 0, null);

I want to set this image as background, but it is displayed only on a part of the screen. How to set it as fullscreen?

There is a way to set the image as background from xml and to draw other images on this image from onDraw Method?

  • 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-26T07:25:54+00:00Added an answer on May 26, 2026 at 7:25 am

    try this:

    ...
    Rect dest = new Rect(0, 0, getWidth(), getHeight());
    Paint paint = new Paint();
    paint.setFilterBitmap(true);
    canvas.drawBitmap(background, null, dest, paint);
    

    This renders a part of the bitmap (“null” means the whole bitmap) to the screen area specified by dest (which is the whole area of the view in this case).

    Note that this will/might change the aspect ratio, depending on the background, you might need to fix that.

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

Sidebar

Related Questions

friends, i am using following onDraw method to display bitmap on screen. @Override public
I would like to display an Image using a Bitmap as source. I've been
I am not able to display image using this code. Could any one help
I'd like to display image on top of div using absolute positioning within jQuery's
In android phonegap application I crated canvas using html and display image in that
I want to display image using base64 encoding in IE using GWT If it
I am using an image to display my map with OpenLayers. My JS code
i can't display the image on my aspx view.. i'm using mysql as database
I want to display a simple GIF image in a VBox using GTK+ from
I'm using an asp.net chart control to display a pie chart, image below. http://i39.tinypic.com/ndtzx1.png

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.