利用几句简单的语句可以根据Resource的displayName获得系统中唯一的标识符,程序可以通过标识符获得Resource。
源代码:
1. int drawable_id = context.getResources().getIdentifier("ball_red", "drawable", context.getPackageName());
文章来源 Androidsnippets.org
利用几句简单的语句可以根据Resource的displayName获得系统中唯一的标识符,程序可以通过标识符获得Resource。
源代码:
1. int drawable_id = context.getResources().getIdentifier("ball_red", "drawable", context.getPackageName());
文章来源 Androidsnippets.org
This entry was posted on Friday, June 26th, 2009 at 12:17 am and is filed under Resource, Tips. You can follow any responses to this entry through the comments feed. You can leave a response, or trackback from your own site.
Tags: Drawable Resource, Identifier
Activity Activity attribute ADC Android Apps Android Market Application Framework BufferedReader Bugs Cloud Computing Contact Cupcake Data Storage DDMS Drawable Emulator G1 Game Garbage Collection Google Map GPS GUI Handler HttpURLConnection I/O Intent IPhone Knowledge Layout Libraries Network News Rotation Screen orientation Socket SQLite Database TCP/IP TED Text-To-Speech Threads Tips TTS UI UI Optimization URI Wifi
WP Cumulus Flash tag cloud by Roy Tanck and Luke Morton requires Flash Player 9 or better.
Android Resource | 资源 资讯 教程 is proudly powered by WordPress. Entries (RSS) .
©Creative Commons.
