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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:53:31+00:00 2026-05-27T16:53:31+00:00

Looking for advice with the next problem. I am developing small game and I

  • 0

Looking for advice with the next problem. I am developing small game and I have a *.png file for background. I need to put it to background of the main game screen. Moreover, it has to bee 2 times bigger in width and 1.5 times bigger in height as the screen’s sizes, because my objects “flight” across these borders. Additionally the screen is moving around this background in a gameplay. But I have stuck a bit on how to do it.

I want my background to look similar on all screens with different sizes and densities. I have tried some solutions but I don’t like them, or I have made something wrong:

  1. Make different background images and put them in special folders. It sounds good, but with the amount of resolutions of Android devices in the market it is not sounds good for me. It will just make the size of *.apk bigger. And if I will use the methods to set background it will stretch the image – not a good idea I think.

  2. In the onDraw() method draw the image on canvas. I have to put it’s top-left corner to the most top-left corner of the possible game area and draw it. But, here is some options:

    • cut from the main image the image i want and draw only this piece (what I use now)
    • resize the image I have and draw with this changes
    • something else…

So, the question is: what is the best option for drawing background for the game screen when you need it to be almost twice bigger than the screen’s size, make it looks same on all devices and move the screen around when the game is played?

  • 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-27T16:53:32+00:00Added an answer on May 27, 2026 at 4:53 pm

    you should use 9 patch image .

    A NinePatchDrawable graphic is a stretchable bitmap image, which Android will automatically resize to accommodate the contents of the View in which you have placed it as the background.

    see this link.
    http://developer.android.com/guide/topics/graphics/2d-graphics.html#nine-patch

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

Sidebar

Related Questions

Looking for advice (perhaps best practice). We have a MS Word document (Office 2007)
I have an interesting problem which I've been looking into and would appreciate some
Looking for advice on framework and approach for building a modular web application. Primary
I'm looking for advice on how to dynamically create content in flash based on
I am looking for advice on how to create a drag and drop interface
I am looking for advice about how to parse a single list, using two
I'm looking for advice, tutorials and links at how to set up a mid-sized
I not a DB expert, so am looking for advice for a web-based system
Looking for some advice on the best way to implement localization along with client
I'm looking for some advice on the best way to provide a single place

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.