Action bar icon size in Android 4.2

后端 未结 2 1113
礼貌的吻别
礼貌的吻别 2020-12-05 08:51

Has the action bar icon size changed in Android 4.2 ? I\'ve had a 120x48px HDPI icon that was rendered perfectly in Android 4.1 and below. It still is.

However, on a

2条回答
  •  长情又很酷
    2020-12-05 09:26

    This is not ideal, but it appears you can get around this limitation by using an custom action view.

    Something like this:

    
    
      
    
    

    Where @layout/log_in_button points to a layout file containing an ImageButton with your icon set as the src.

    You will have to bind the click listener in the OnCreateOptionsMenu method. There is a halfway good example here: http://developer.android.com/guide/topics/ui/actionbar.html#ActionView.

    I only just learned to use this method, so I don't know yet if there are any major downfalls besides the increased complexity.

提交回复
热议问题