Icons in menu are smaller than they should be

梦想的初衷 提交于 2019-12-09 07:33:32

问题


SOLVED: I was using icons from sdk v9 (Android 2.3 Gingerbread) which seems to have different dimension. The asset studio also creates icons for 2.3. So I placed gingerbread icons to drawable-xxpi-v9 and for older versions I put icons from SDK v8 to drawable-hdpi and it works fine now

Original question: Hello I have a little problem. All the icons in my apk are smaller than the same icons in other apps (Gmail etc.) This is how it looks like in my apk and this is the same icon in Gmail.apk. I have copied these icons directly from SDK to the specific folders for hdpi, mdpi and ldpi.

Here is an example of a hdpi icon I use and my menu.xml

   <?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
 <item
  android:id="@+id/refresh"
  android:title="@string/refresh"
  android:icon="@drawable/ic_menu_refresh" />
 <item
  android:id="@+id/add"
  android:title="@string/add"
  android:icon="@drawable/ic_menu_add" />
 <item
  android:id="@+id/login"
  android:title="@string/account"
  android:icon="@drawable/ic_menu_login" />
</menu>

Does anybody know how to make these icon have the same size as in other apk's? I have tried the asset studio with no effect.

UPDATE: If I reference an icon directly from android (android:drawable) then it has normal size. However not all icons can be referenced.


回答1:


Make sure you have the proper <supports-screens> element in your manifest.




回答2:


I was using icons from sdk v9 (Android 2.3 Gingerbread) which seems to have different size. The asset studio also creates icons for 2.3. So I placed gingerbread icons to drawable-xxpi-v9 and for older versions I put icons from SDK v8 to drawable-hdpi and it works fine now.



来源:https://stackoverflow.com/questions/4627730/icons-in-menu-are-smaller-than-they-should-be

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!