나는 네비게이션 서랍을 사용하고있는 앱을 개발하고 있습니다. 항목에 아이콘을 넣으려고하면 다음과 같은 이미지가 나타납니다 : " res/drawale/bg.jpg "를 참조하십시오. 나는 그것을하는 방법을 얻지 못하고있다.네비게이션 서랍에있는 항목에 아이콘을 넣는 법
app:menu="@menu/drawer_menu_icons"
을 다음 : 여기
private void init_navigator() {
// Navigation Drawer
mTitle = mDrawerTitle = getTitle();
mDrawerLayout = (DrawerLayout) findViewById(R.id.main_activity_DrawerLayout);
mDrawerLayout.setStatusBarBackgroundColor(getResources().getColor(R.color.primaryDark));
mScrimInsetsFrameLayout = (ScrimInsetsFrameLayout) findViewById(R.id.main_activity_navigation_drawer_rootLayout);
mDrawerList = (ListView) findViewById(R.id.left_drawer);
mDrawerItmes = getResources().getStringArray(R.array.drawer_titles);
mDrawerItmes = getResources().getStringArray(R.array.nav_drawer_icons);
이 추가 XML에 navigationview에서 string.xml
<string-array name="drawer_titles">
<item>About Us</item>
<item>FeedBack</item>
<item>Setting</item>
<item>Share App</item>
<item>Rate Us</item>
<item>Logout</item>
</string-array>
<array name="nav_drawer_icons">
<item>@drawable/bg</item>
<item>@drawable/bg</item>
<item>@drawable/bg</item>
<item>@drawable/bg</item>
<item>@drawable/b</item>
<item>@drawable/bg</item>
</array>
찾고 정확히 당신이 경우 네비게이션 뷰를 사용하면 [제목 및 아이콘이있는] 메뉴를 쉽게 만들 수 있고 메뉴를 팽창시킬 수 있습니다. 그는 xml 속성으로 navigationview 더 명확하게 http://www.technotalkative.com/part-4-playing-with-navigationview/에서보세요 여기에 –
어떻게 줄 수 있습니다 .. 당신은 어떤 생각이있어. – user6798766
DrawerLayout 메뉴를 보유하기위한 홀더를 의미합니다. 명시 적으로 탐색보기 (메뉴)를 xml에 추가하고 메뉴를 팽창시켜야합니다 –