I'm trying to use the android.R.drawable stat_sys_download as the background image for a text view but it's not showing up:
textview.setBackgroundDrawable(getResources().getDrawable(android.R.drawable.stat_sys_download));
If I use a different android.R.drawable like ic_menu_save it works fine:
textview.setBackgroundDrawable(getResources().getDrawable(android.R.drawable.ic_menu_save));
I can however use stat_sys_download as an icon on a menu option so I know it exists:
menu.add(0, OPTION_MENU_SORTBY, 0, Str.TEXT_SORTBY).setIcon(android.R.drawable.stat_sys_download);
So why is it that I can use stat_sys_download as an icon but not as a background? Should I copy it into my resources folder and use it that way?
From Google's UI Guidelines for Status Bar Icons (also can be applied towards other drawable elements)
Warning: Because these resources can change between platform versions, you should not reference these icons using the Android platform resource IDs (i.e. status bar 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With