Increase buttons "click-surface"

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

Increase buttons "click-surface"

Postby sandis84 » Wed Nov 11, 2009 11:40 am

So I have this problem: I have a rather small button in my layout. It looks really good to have it that small, but unfortunately it is a bit hard to click on it. So I want to increase the area that results in a click. If it were an imageView, then I could simply add padding, and the layout would grow without the image getting bigger. This does not work with buttons, as the button also looks bigger when increasing padding.

I guess I could encapsule the button in a framelayout, add an onclicklistener to the framelayout that in turn calls the performClick-function on the button. But that is an ugly solution, and it results in other complicated problems that I have trouble putting into text.

I hope you got some suggestions for me. =)

Cheers,
Per Sandström
sandis84
Experienced Developer
Experienced Developer
 
Posts: 78
Joined: Fri Aug 07, 2009 3:54 pm

Top

Postby I_Artist » Wed Nov 11, 2009 3:55 pm

Is your button a bitmapped button (owner drawn)? You could just have a transparent area surrounding your button if that is the case.


And well, the more I think of it, if it is not the case.... It should be :D

Cheers!
The I_Artist

follow me on Twitter: @I_Artist
follow Android Development on Twitter: #androiddev

Show the world that you are an #androiddev, wear the badge http://www.twibbon.com/join/androiddev
User avatar
I_Artist
Developer
Developer
 
Posts: 33
Joined: Fri Oct 16, 2009 3:49 am
Location: St-Eustache, Quebec

Postby sandis84 » Wed Nov 11, 2009 4:05 pm

Hi!

Great minds think alike, because that is exactly what I have done. However, this proved to complicate things quite a bit, especially now that I am adapting my app to look and feel great in WVGA and QVGA. Everytime an image is a bit to big, instead of just changing a variable in the XML, I have to open photoshop (an environment I dont fully master :P). Today I have edited just about 80 images to fit my new measures for better clickability... it wasnt fun, but I had to do it. I really would like to find a smoother way to do this, that does not include only using customized imageviews instead of buttons and checkboxes, or working in photoshop all day :P

hmm... maybe I could ask some designer with coding skillz to make a script to add these transparent boundaries.
sandis84
Experienced Developer
Experienced Developer
 
Posts: 78
Joined: Fri Aug 07, 2009 3:54 pm

Postby I_Artist » Wed Nov 11, 2009 4:24 pm

look up png-9

or png.9

or whatever it is...

That should help you a lot...

Cheers
The I_Artist

follow me on Twitter: @I_Artist
follow Android Development on Twitter: #androiddev

Show the world that you are an #androiddev, wear the badge http://www.twibbon.com/join/androiddev
User avatar
I_Artist
Developer
Developer
 
Posts: 33
Joined: Fri Oct 16, 2009 3:49 am
Location: St-Eustache, Quebec

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 15 guests