拍摄图像资源时出错

时间:2015-01-01 05:12:55

标签: android

我正在尝试将抽屉图标添加到操作栏,但它在R.drawable.ic_drawer中显示错误。 我试过这个:

 drawerListener =new ActionBarDrawerToggle(
            this, //host activity (use getActivity() if in other code file to access host activity
            drawerLayout,
            R.drawable.ic_drawer, //icon for drawer
            R.string.navigation_drawer_open,
            R.string.navigation_drawer_close ){

        //on opening of drawer
        @Override
        public void onDrawerOpened(View drawerView) {
            //wrie the event you want to create after the drawer is fully opened
            //make a toast for instance
            super.onDrawerOpened(drawerView);
        }

        //on closing of drawer
        @Override
        public void onDrawerClosed(View drawerView) {
            //wrie the event you want to create after the drawer is fully closed
            //make a toast for instance
            super.onDrawerClosed(drawerView);
        }


    };

1 个答案:

答案 0 :(得分:0)

检查您是否已导入android.R。 如果是,请删除此导入并导入您自己的R

导入R执行此操作:

import yourPackage.R

用您的包裹替换youPackage