specify ImageButton size

Put your problem here if it does not fit any of the other categories.

specify ImageButton size

Postby ryank » Mon Mar 10, 2008 6:20 pm

I have an image that is 32x32 and chose wrap_content for width and height of my imageButton. It appears to be more like 64x64. Can I specify the width and height? I tried 40px, but that didn't seem to work.
User avatar
ryank
Developer
Developer
 
Posts: 43
Joined: Mon Jan 28, 2008 3:23 am

Top

Postby plusminus » Mon Mar 10, 2008 7:35 pm

Hello ryank,

of course the has to be some padding around your Image. But 64x64 on a 32x32 image seems pretty much.
[Edit]Uh, its more than I though. A 32x32 image on a ImageButton resolves in a size of 54x54.[/Edit]

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby ryank » Tue Mar 11, 2008 1:51 pm

If I remember right, the button was that size even with a 24x24 image. I may resort to setting up the OnClick listener for an ImageView. Down side is I will probably loose some of the functionality, including the feedback for the user when an image is pressed.
User avatar
ryank
Developer
Developer
 
Posts: 43
Joined: Mon Jan 28, 2008 3:23 am

Postby ryank » Wed Mar 12, 2008 3:26 pm

I changed all of my ImageButtons to ImageViews and it is working out much better. I'm getting ready to add the code so that when the ImageView is being pressed, the color changes.

Is the best way to
a) change it on the onKeyDown and onKeyUp event, or
b) invalidate the draw and check the isPressed boolean

thanks for your help.
User avatar
ryank
Developer
Developer
 
Posts: 43
Joined: Mon Jan 28, 2008 3:23 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 19 guests