Ошибка в этом больше появляться /* // Userprofile 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)));Когда Генерирование Подписано APK: Ошибка: (131) Ошибка: Ожидаемый ресурс типа styleable [ResourceType]
//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 общественности Посмотреть onCreateView (LayoutInflater инфлятор, ViewGroup контейнер, Bundle savedInstanceState) { Посмотреть rootView = inflater.inflate (R.layout.fragment_navigation_drawer, контейнер, ложь) ; 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)));
/* // UserProfile 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;
}