Use different icons with different Android SDK versions

前端 未结 2 1112
抹茶落季
抹茶落季 2021-01-31 11:39

I have icons for my Android menu. On Android 3+ I\'m using a black ActionBar so the icons are white. However, on Android 2.x the menu is inherently white which means the icons a

2条回答
  •  一向
    一向 (楼主)
    2021-01-31 12:17

    Found on the android dev site: http://developer.android.com/guide/practices/ui_guidelines/icon_design_menu.html

    Warning: Because these resources can change between platform versions, you should not reference these icons using the Android platform resource IDs (i.e. menu icons under android.R.drawable). If you want to use any icons or other internal drawable resources, you should store a local copy of those icons or drawables in your application resources, then reference the local copy from your application code. In that way, you can maintain control over the appearance of your icons, even if the system's copy changes. Note that the grid below is not intended to be complete.

    /res/drawable-hdpi (for Android 2.2 and below)

    /res/drawable-hdpi-v# (for Android 2.3 and above)

    Have you also tried testing this on a 2.1+ phone and not an emulator? If you don't have a phone, try creating another AVD? I'm afraid that you're going to need the separate folders.

    Hopefully this helps.

提交回复
热议问题