为什么我在设置背景图像时在android studio中出现此错误

时间:2015-06-20 14:41:28

标签: android android-studio background

  

我想在android studio中为我的项目设置背景图像,每当我设置背景时我都会收到此错误,文件的名称为xxx.jpg

有没有其他方法在android studio中设置背景图像或者格式有什么问题,一旦我删除它工作的背景图像但我真的需要设置背景图像,因为我希望在存储

我多次出现此错误,并且有多张图片! This is the error i am getting all the time

     public static final class drawable {
                        public static final int 2=0x7f020000;
            //i get the error here^ (2=0x7f020000;)
                        public static final int abc_ab_share_pack_holo_dark=0x7f020001;
                        public static final int abc_ab_share_pack_holo_light=0x7f020002;
                        public static final int abc_btn_check_material=0x7f020003;
                        public static final int abc_btn_check_to_on_mtrl_000=0x7f020004;
                        public static final int abc_btn_check_to_on_mtrl_015=0x7f020005;
                        public static final int abc_btn_radio_material=0x7f020006;
                        public static final int abc_btn_radio_to_on_mtrl_000=0x7f020007;
                        public static final int abc_btn_radio_to_on_mtrl_015=0x7f020008;
                        public static final int abc_btn_switch_to_on_mtrl_00001=0x7f020009;
                        public static final int abc_btn_switch_to_on_mtrl_00012=0x7f02000a;
                        public static final int abc_cab_background_internal_bg=0x7f02000b;
                        public static final int abc_cab_background_top_material=0x7f02000c;
                        public static final int abc_cab_background_top_mtrl_alpha=0x7f02000d;
                        public static final int abc_edit_text_material=0x7f02000e;
                        public static final int abc_ic_ab_back_mtrl_am_alpha=0x7f02000f;
                        public static final int abc_ic_clear_mtrl_alpha=0x7f020010;
                        public static final int abc_ic_commit_search_api_mtrl_alpha=0x7f020011;
                        public static final int abc_ic_go_search_api_mtrl_alpha=0x7f020012;
                        public static final int abc_ic_menu_copy_mtrl_am_alpha=0x7f020013;
                        public static final int abc_ic_menu_cut_mtrl_alpha=0x7f020014;
                        public static final int abc_ic_menu_moreoverflow_mtrl_alpha=0x7f020015;
                        public static final int abc_ic_menu_paste_mtrl_am_alpha=0x7f020016;
                        public static final int abc_ic_menu_selectall_mtrl_alpha=0x7f020017;
                        public static final int abc_ic_menu_share_mtrl_alpha=0x7f020018;
                        public static final int abc_ic_search_api_mtrl_alpha=0x7f020019;
                        public static final int abc_ic_voice_search_api_mtrl_alpha=0x7f02001a;
                        public static final int abc_item_background_holo_dark=0x7f02001b;
                        public static final int abc_item_background_holo_light=0x7f02001c;
                        public static final int abc_list_divider_mtrl_alpha=0x7f02001d;
                        public static final int abc_list_focused_holo=0x7f02001e;
                        public static final int abc_list_longpressed_holo=0x7f02001f;
                        public static final int abc_list_pressed_holo_dark=0x7f020020;
                        public static final int abc_list_pressed_holo_light=0x7f020021;
                        public static final int abc_list_selector_background_transition_holo_dark=0x7f020022;
                        public static final int abc_list_selector_background_transition_holo_light=0x7f020023;
                        public static final int abc_list_selector_disabled_holo_dark=0x7f020024;
                        public static final int abc_list_selector_disabled_holo_light=0x7f020025;
                        public static final int abc_list_selector_holo_dark=0x7f020026;
                        public static final int abc_list_selector_holo_light=0x7f020027;
                        public static final int abc_menu_hardkey_panel_mtrl_mult=0x7f020028;
                        public static final int abc_popup_background_mtrl_mult=0x7f020029;
                        public static final int abc_spinner_mtrl_am_alpha=0x7f02002a;
                        public static final int abc_switch_thumb_material=0x7f02002b;
                        public static final int abc_switch_track_mtrl_alpha=0x7f02002c;
                        public static final int abc_tab_indicator_material=0x7f02002d;
                        public static final int abc_tab_indicator_mtrl_alpha=0x7f02002e;
                        public static final int abc_textfield_activated_mtrl_alpha=0x7f02002f;
                        public static final int abc_textfield_default_mtrl_alpha=0x7f020030;
                        public static final int abc_textfield_search_activated_mtrl_alpha=0x7f020031;
                        public static final int abc_textfield_search_default_mtrl_alpha=0x7f020032;
                        public static final int abc_textfield_search_material=0x7f020033;
                        public static final int buttonshape=0x7f020034;
                        public static final int ic_launcher=0x7f020035;
                        public static final int xxx=0x7f020036;
                    }

1 个答案:

答案 0 :(得分:1)

您有一个名为drawable的{​​{1}}。 2.png的所有内容都在res/中翻译,文件名称用作变量名称。系统为此变量分配一个int,用于在运行时引用资源。因为在java中你不能使用R.java作为变量名,所以你得到这个编译时错误。以满足变量名称

的java rules的方式重命名文件