Button hitbox

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Button hitbox

Postby Ashsturm » Thu Jan 07, 2010 4:24 pm

I'm currently considering creating a Android game as a project for college next year and I hope that I have a basic idea of how to put the game together thanks in part to the tutorials and examples here.

One problem eludes me at the moment though, as a grid-based isometic game the tiles will not be displayed as square however I would like the user to be able to use the touch screen to select each tile. Past experience with other platforms has taught me not to expect the ImageButton to automatically map the touch hit box around the image taking into account the transparent areas of the image, instead I'd expect the hitbox to still be square. Am I wrong? Is there a way to get around this? or is a button not the right way to approach the situation?

Once Poster
Once Poster
Posts: 1
Joined: Thu Jan 07, 2010 4:08 pm


Re: Button hitbox

Postby jagtap.jj1 » Mon Jan 11, 2010 9:41 am

Use "GridView" http://developer.android.com/reference/ ... dView.html
And use mGridView.setOnItemClickListener(), for tracking click event on grid tile.
java-android developer
User avatar
Senior Developer
Senior Developer
Posts: 124
Joined: Fri Aug 22, 2008 11:52 am
Location: India(Mumbai)


Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 2 guests