1

I'm having sizing issues with my action bar buttons on Android 4.2.2. On all other versions, the sizes are acceptable (thought it's still maddening that I can't get one standard size). Android 4.2 appears to be constraining the widths of the buttons (which are rectangular and not squares) down to fit within the width of whatever 4.2 feels that the action bar buttons ought to be. Is there a way to instruct the program how wide action bar buttons ought to be, or how wide my specific buttons ought to be?

I've created a test project that has my action bar background and one of my buttons, in order to try to track down the problem. Here is how it appears in the emulator for the problematic 4.2: http://i1364.photobucket.com/albums/r728/jasonjtyler/ScreenShot2013-06-27at110115AM_zps9b1bd09a.png?t=1372349904

Here it is in 4.0, which is basically representative of the other versions also (besides 4.2): http://i1364.photobucket.com/albums/r728/jasonjtyler/ScreenShot2013-06-27at110951AM_zpsa5734a91.png?t=1372349914

Thanks for any help.

Jason

Casey Perkins
  • 1,853
  • 2
  • 23
  • 41
  • What is you unit? `dp` or `px`? – Yann Masoch Jun 27 '13 at 16:44
  • Hi Yann, there is no size unit specified. My buttons have been specified in the menu xml, which does not allow button sizing info as far as I'm aware. – Casey Perkins Jun 27 '13 at 16:48
  • 1
    http://stackoverflow.com/questions/13519710/action-bar-icon-size-in-android-4-2 This probably have answer to your question. – user1685095 Jun 27 '13 at 17:07
  • Hey Jason, do you use a image for your button (like an icone)? The button looks to have the same image with different scale between your 2 examples. Do you use different drawable folders on android to have different density (`drawable-mdpi`, `drawable-hdpi` and `drawable-xhdpi`)? – Yann Masoch Jun 27 '13 at 17:09
  • Thanks, user1685095, that does appear to be the answer. I'll apply the code in the listed solution. If you want to post it as the answer, I'll accept it. Thanks to everyone else who pitched in as well. – Casey Perkins Jun 27 '13 at 17:13

1 Answers1

-1

Um... What I see in a picture in not in line with design guides and doesn't look good.

My guess is that you are trying to do something the way you shouldn't do it.

Make your button standrard sizes and in a shape of a square not a rectangle. For cancel option there exists standard image of a cross. enter image description here

I think you should use this image, but customised it to your desing.

Action bar icon size in Android 4.2

Community
  • 1
  • 1
user1685095
  • 5,787
  • 9
  • 51
  • 100
  • 1
    Of course it doesn't look good, this is only a piece of my action bar layout. OK, what I'm asking is whether it is possible on 4.2 to do what it is possible to do on every other version of Android, not whether my design is standard or looks good in anyone else's eyes. – Casey Perkins Jun 27 '13 at 16:45
  • I didn't answer your question, I know it. It's just seems to me that you're asking the wrong question. The piece of a good layout look good. I think that your whole layout look like that piece. Which is not good :) For what reason exactly you want to do it that way? – user1685095 Jun 27 '13 at 16:48
  • It appears that Android 4.2.2 also thinks (so to speak) that I should be using squares. I would hope more flexibility is at least allowed though. – Casey Perkins Jun 27 '13 at 16:51
  • http://stackoverflow.com/questions/13519710/action-bar-icon-size-in-android-4-2 Well, flexibility is good. But to make UX across all android apps more consistent is looks more appealing =) I've edited my answer with link to similar question. – user1685095 Jun 27 '13 at 16:53
  • are those standard icons? a picture of a floppy disk is the standard save icon on android?? – CQM Jun 27 '13 at 16:57
  • Not exactly I think. I just can't find standard icons fast (they actually downloadable from android developers site) and thats the best picture I got from googling. – user1685095 Jun 27 '13 at 17:00