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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:38:55+00:00 2026-06-04T04:38:55+00:00

I’m an absolute beginner at Android programming, so please bear with me :) For

  • 0

I’m an absolute beginner at Android programming, so please bear with me 🙂
For my simple game, I’m drawing a 20 x 10 grid consisting of squares at the beginning.
Within the game, I would need to draw a sprite right at the center of some of the squares.
(analogous to a Checkers grid, with a chip at the center of each square). I want this game to work across various screen sizes and densities. My approach has been to get the canvas width and height at the beginning of the game, calculate the side of the squares and then draw the grid out and save that as a bitmap, and then use that bitmap in the game. That way my grid would scale perfectly across screens.

1) Is there a better approach? Can I use an image of a grid as a bitmap instead? My concern there is that when the image is scaled for different screens, the squares might get distorted into rectangles. Plus it will be hard to calculate where the center of each scaled square is (to place the sprite).

2) I also need to display the title, score, level etc. at some place on the screen. Is it better to just leave space for it on the bitmap and then write the score on the bitmap, or to create a layout with a SurfaceView for the grid and another view where I write the score, level, etc?

Thanks!

  • 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-04T04:38:56+00:00Added an answer on June 4, 2026 at 4:38 am

    Use Nine-Patch .png images and first create either an image which represents one square or create one which represents your 20×10 grid – your choice. Do this so it looks right on an mdpi (medium dot-per-inch) screen.

    Then you will need to create pre-scaled images for the other screen densities you intend to support. The one for ldpi will be 0.75 of the original, hdpi is 1.5x the size of the original and xhdpi is 2x the original.

    You then put the images in the relevant drawable resource directory of your project – example /res/drawable-mdpi and /res/drawable-hdpi and so on.

    Give the images exactly the same name for each density, e.g., square.png or grid.png. As long as those drawable directories contain an image of the same name, Android will find the right one for the right density and use it.

    It’s a long bit of documentation but you really need to read…

    Supporting Multiple Screens

    …particularly the part for Alternative Drawables.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
Seemingly simple, but I cannot find anything relevant on the web. What is the
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm making a simple page using Google Maps API 3. My first. One marker
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but

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.