/*//UserProfile NavDraweritems.add(new NavDrawerItem(NavMenutitles[1],NavMenuicons.getResourceId(1,-1)));*///Payment NavDraweritems.add(new NavDrawerItem(NavMenutitles[1],NavMenuicons.getResourceId(1,-1)))中出现错误occure;//邀请好友navdraweritems.add(新建NavDrawerItem(navmenutitles[2],navmenuicons.getResourceId(2,-1)));//帮助navdraweritems.add(新建NavDrawerItem(navmenutitles[3],navmenuicons.getResourceId(3,-1)));
//Trip History
navDrawerItems.add(new NavDrawerItem(navMenuTitles[4], navMenuIcons.getResourceId(4, -1)));
navDrawerItems.add(new NavDrawerItem(navMenuTitles[5], navMenuIcons.getResourceId(5, -1)));
navDrawerItems.add(new NavDrawerItem(navMenuTitles[6], navMenuIcons.getResourceId(6, -1)));
navDrawerItems.add(new NavDrawerItem(navMenuTitles[7], navMenuIcons.getResourceId(7, -1)));
navDrawerItems.add(new NavDrawerItem(navMenuTitles[8], navMenuIcons.getResourceId(8, -1)));
以下是我的完整代码:@override public View onCreateView(LayoutInflater,ViewGroup container,Bundle savedInstanceState){View rootView=inflater.inflate(r.layout.fragment_navigation_drawer,container,false);mDrawerListView=(ListView)rootView.findviewbyid(r.id.listviewdrawer);mToolbar=((NavigationActivity)getActivity()).getToolbar();
/* mDrawerListView = (ListView) inflater.inflate(
R.layout.fragment_navigation_drawer, container, false);*/
// load slide menu items
String[] navMenuTitles = getResources().getStringArray(R.array.nav_drawer_items);
// nav drawer icons from resources
TypedArray navMenuIcons = getResources().obtainTypedArray(R.array.nav_drawer_icons);
mDrawerListView.setItemChecked(mCurrentSelectedPosition, true);
ArrayList<NavDrawerItem> navDrawerItems = new ArrayList<NavDrawerItem>();
// adding nav drawer items to array
// Home
navDrawerItems.add(new NavDrawerItem(navMenuTitles[0], navMenuIcons.getResourceId(0, -1)));
/*//用户配置文件navdraweritems.add(新建NavDrawerItem(NavMenutitles[1],navMenuicons.getResourceID(1,-1)));*///付款navdraweritems.add(新建NavDrawerItem(NavMenutitles[1],navMenuicons.getResourceID(1,-1)));//邀请好友navdraweritems.add(新建NavDrawerItem(navmenutitles[2],navmenuicons.getResourceId(2,-1)));//帮助navdraweritems.add(新建NavDrawerItem(navmenutitles[3],navmenuicons.getResourceId(3,-1)));
//Trip History
navDrawerItems.add(new NavDrawerItem(navMenuTitles[4], navMenuIcons.getResourceId(4, -1)));
navDrawerItems.add(new NavDrawerItem(navMenuTitles[5], navMenuIcons.getResourceId(5, -1)));
navDrawerItems.add(new NavDrawerItem(navMenuTitles[6], navMenuIcons.getResourceId(6, -1)));
navDrawerItems.add(new NavDrawerItem(navMenuTitles[7], navMenuIcons.getResourceId(7, -1)));
navDrawerItems.add(new NavDrawerItem(navMenuTitles[8], navMenuIcons.getResourceId(8, -1)));
//驱动器模式开/关
// Recycle the typed array
navMenuIcons.recycle();
// setting the nav drawer list adapter
adapter = new NavDrawerListAdapter(getActivity(),
navDrawerItems);
mDrawerListView.setAdapter(adapter);
mDrawerListView
.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
selectItem(position);
adapter.setSelectedItem(position);
}
});
// Select either the default item (0) or the last selected item.
selectItem(mCurrentSelectedPosition);
adapter.setSelectedItem(mCurrentSelectedPosition);
return rootView;
}
试试这个(为我工作)
android{
lintOptions {
disable "ResourceType"}
}
请看一下这段代码。最后一行出现了一个错误,因为我传递的是一个“索引”而不是一个资源。我以为是皮毛的问题,试图压制它。然后我注意到只有在构建发布时才会出现这个错误。它在构建调试时工作良好。我完全一无所知。谁能告诉我我做错了什么。
该项目运行良好,但当我尝试生成签名APK时,它显示了一个错误:错误:在Main活动中,预期资源类型为可绘制[ResourceType]: 当您点击按钮时,应用程序会显示图像并播放声音。问题是为什么在声音的情况下一切都好,但这里有一个错误: 我很感激任何帮助
我有这个问题,当我生成签名apk: F:\。。。\app\src\main\java\com\palletdesign\clipdooni\Activity\u VideoPlay。java错误:错误:类型为字符串[ResourceType]的预期资源 这是活动视频游戏。java(这部分代码的错误):
在android studio中,当我想要生成签名apk时,会导致以下错误:
在android studio中,当我想要生成签名apk时,会导致以下错误:
请帮助我如何在关于触觉的 行中: 消息gradle Builder中的问题: 错误:错误:类型字符串的预期资源[ResourceType]