转载自:http://blog.youkuaiyun.com/jishu360/article/details/8540026
1、引用方式
在源代码*.Java中可以进入如下方式引用:
myMenuItem.setIcon(android.R.drawable.ic_menu_save);
在*.XML文件中的<resource>可以进行如下引用:
android:icon="@android:drawable/ic_menu_save"
2、图标展示
![]() alert_dark_frame | ![]() alert_light_frame | ![]() arrow_down_float |
![]() arrow_up_float | ![]() bottom_bar | ![]() btn_default |
![]() btn_default_small | ![]() btn_dialog | ![]() btn_dropdown |
![]() btn_minus | ![]() btn_plus | ![]() btn_radio |
![]() btn_star | ![]() btn_star_big_off | ![]() btn_star_big_on |
![]() button_onoff_indicator_off | ![]() button_onoff_indicator_on | ![]() checkbox_off_background |
![]() checkbox_on_background | ![]() dark_header | ![]() dialog_frame |
![]() divider_horizontal_bright | ![]() divider_horizontal_dark | ![]() divider_horizontal_dim_dark |
![]() divider_horizontal_textfield | ![]() edit_text | ![]() editbox_background |
![]() editbox_background_normal | ![]() editbox_dropdown_dark_frame | ![]() editbox_dropdown_light_frame |
![]() gallery_thumb | ![]() ic_btn_speak_now | ![]() ic_delete |
![]() ic_dialog_alert | ![]() ic_dialog_dialer | ![]() ic_dialog_email |
![]() ic_dialog_info | ![]() ic_dialog_map | ![]() ic_input_add |
![]() ic_input_delete | ![]() ic_input_get | ![]() ic_lock_idle_alarm |
![]() ic_lock_idle_charging | ![]() ic_lock_idle_lock | ![]() ic_lock_idle_low_battery |
![]() ic_lock_lock | ![]() ic_lock_power_off | ![]() ic_lock_silent_mode |
![]() ic_lock_silent_mode_off | ![]() ic_media_ff | ![]() ic_media_next |
![]() ic_media_pause | ![]() ic_media_play | ![]() ic_media_previous |
![]() ic_media_rew | ![]() ic_menu_add | ![]() ic_menu_agenda |
![]() ic_menu_always_landscape_portrait | ![]() ic_menu_call | ![]() ic_menu_camera |
![]() ic_menu_close_clear_cancel | ![]() ic_menu_compass | ![]() ic_menu_crop |
![]() ic_menu_day | ![]() ic_menu_delete | ![]() ic_menu_directions |
![]() ic_menu_edit | ![]() ic_menu_gallery | ![]() ic_menu_help |
![]() ic_menu_info_details | ![]() ic_menu_manage | ![]() ic_menu_mapmode |
![]() ic_menu_month | ![]() ic_menu_more | ![]() ic_menu_my_calendar |
![]() ic_menu_mylocation | ![]() ic_menu_myplaces | ![]() ic_menu_preferences |
![]() ic_menu_recent_history | ![]() ic_menu_report_image | ![]() ic_menu_revert |
![]() ic_menu_rotate | ![]() ic_menu_save | ![]() ic_menu_search |
![]() ic_menu_send | ![]() ic_menu_set_as | ![]() ic_menu_share |
![]() ic_menu_slideshow | ![]() ic_menu_sort_alphabetically | ![]() ic_menu_sort_by_size |
![]() ic_menu_today | ![]() ic_menu_upload | ![]() ic_menu_upload_you_tube |
![]() ic_menu_view | ![]() ic_menu_week | ![]() ic_menu_zoom |
![]() ic_notification_clear_all | ![]() ic_notification_overlay | ![]() ic_partial_secure |
![]() ic_popup_disk_full | ![]() ic_popup_reminder | ![]() ic_popup_sync |
![]() ic_search_category_default | ![]() ic_secure | ![]() menu_frame |
![]() menu_full_frame | ![]() picture_frame | ![]() presence_away |
![]() presence_busy | ![]() presence_invisible | ![]() presence_offline |
![]() presence_online | ![]() progress_indeterminate_horizontal | ![]() radiobutton_off_background |
![]() radiobutton_on_background | ![]() spinner_background | ![]() spinner_dropdown_background |
![]() star_big_off | ![]() star_big_on | ![]() star_off |
![]() star_on | ![]() stat_notify_call_mute | ![]() stat_notify_chat |
![]() stat_notify_error | ![]() stat_notify_missed_call | ![]() stat_notify_more |
![]() stat_notify_sdcard | ![]() stat_notify_sdcard_prepare | ![]() stat_notify_sdcard_usb |
![]() stat_notify_sync | ![]() stat_notify_sync_noanim | ![]() stat_notify_voicemail |
![]() stat_sys_data_bluetooth | ![]() stat_sys_download | ![]() stat_sys_download_done |
![]() stat_sys_headset | ![]() stat_sys_phone_call | ![]() stat_sys_phone_call_forward |
![]() stat_sys_phone_call_on_hold | ![]() stat_sys_speakerphone | ![]() stat_sys_upload |
![]() stat_sys_upload_done | ![]() stat_sys_vp_phone_call | ![]() stat_sys_vp_phone_call_on_hold |
![]() stat_sys_warning | ![]() status_bar_item_app_background | ![]() status_bar_item_background |
![]() sym_action_call | ![]() sym_action_chat | ![]() sym_action_email |
![]() sym_call_incoming | ![]() sym_call_missed | ![]() sym_call_outgoing |
![]() sym_contact_card | ![]() sym_def_app_icon | ![]() title_bar |
![]() title_bar_tall | ![]() toast_frame | ![]() zoom_plate |
3、演示示例
如下源码:
- import android.app.Activity;
- import android.content.Context;
- import android.os.Bundle;
- import android.view.*;
- import android.widget.*;
- import android.widget.AdapterView.*;
- public class AndroidRDrawable extends Activity {
- private AndroidRDrawable ard=this;
- private LinearLayout mainView=null;
- private TextView tv=null;
- private GridView gv=null;
- private int id=0x01080000;
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- mainView=new LinearLayout(this);
- mainView.setOrientation(LinearLayout.VERTICAL);
- tv=new TextView(this);
- tv.setText("这里显示图标名称和id及其尺寸");
- gv_init();
- mainView.addView(tv);
- mainView.addView(gv);
- setContentView(mainView);
- }
- /*gv初始化*/
- void gv_init(){
- gv=new GridView(this);
- GridView.LayoutParams lp=new GridView.LayoutParams(-1,-1);
- gv.setLayoutParams(lp);
- gv.setNumColumns(GridView.AUTO_FIT);
- gv.setVerticalSpacing(10);
- gv.setHorizontalSpacing(10);
- gv.setAdapter(new ImageAdapter(this));
- gv.setFocusableInTouchMode(true);
- gv.setOnItemClickListener(new OnItemClickListener(){
- public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,long arg3) {
- tv.setText("图标名称:"+ard.getResources().getResourceEntryName(0x01080000+arg2)+"\n");
- tv.append("图标Id:0x"+Integer.toHexString(0x10800000+arg2)+"\n");
- tv.append("图标大小:"+arg1.getWidth()+"x"+arg1.getHeight()+"\n");
- }
- });
- gv.setOnItemSelectedListener(new OnItemSelectedListener(){
- public void onItemSelected(AdapterView<?> arg0, View arg1,int arg2, long arg3) {
- tv.setText("图标名称:"+ard.getResources().getResourceEntryName(0x01080000+arg2)+"\n");
- tv.append("图标Id:0x"+Integer.toHexString(0x10800000+arg2)+"\n");
- tv.append("图标大小:"+arg1.getWidth()+"x"+arg1.getHeight()+"\n");
- }
- public void onNothingSelected(AdapterView<?> arg0) {
- }
- });
- }
- class MyThread extends Thread{
- }
- /*ImageAdapter*/
- public class ImageAdapter extends BaseAdapter {
- private Context context;
- public ImageAdapter(Context c) {context = c;}
- public int getCount() {return 152;}
- public Object getItem(int position) {return position;}
- public long getItemId(int position) {return position;}
- public View getView(int position, View convertView, ViewGroup parent) {
- ImageView iv = new ImageView(context);
- iv.setLayoutParams(new GridView.LayoutParams(-2,-2));
- id=0x01080000+position;
- iv.setImageResource(id);
- iv.setScaleType(ImageView.ScaleType.CENTER_CROP);
- return iv;
- }
- }
- }