久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何將圖標(biāo)添加到導(dǎo)航抽屜中的項目

How to add icons to items in a navigation drawer(如何將圖標(biāo)添加到導(dǎo)航抽屜中的項目)
本文介紹了如何將圖標(biāo)添加到導(dǎo)航抽屜中的項目的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我希望在我的導(dǎo)航抽屜中的項目旁邊有圖標(biāo),我設(shè)置如下:

I would like to have icons next to my items in my navigation drawer that I have set up like this:

    Titles = getResources().getStringArray(R.array.array1);
    Icons = getResources().getIntArray(R.array.icons);
    mDrawerLayout = (DrawerLayout)findViewById(R.id.Welcome);
    mDrawerList = (ListView) findViewById(R.id.left_drawer);
    mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
    mDrawerList.setAdapter( new ArrayAdapter<String>(this, R.layout.drawer_list_item, Titles));

我知道該過程必須涉及將圖像視圖添加到位于抽屜列表項的 XML 中的文本視圖中,但我不知道該怎么做.實(shí)現(xiàn)這一目標(biāo)的最佳方法是什么?

I know that the process must involve adding an image view to the text view that is in the XML for the drawer_list_item but I'm not sure how to do that. What is the best way to accomplish this?

這是我的drawer_list_item.xml:

This is my drawer_list_item.xml:

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:gravity="center_vertical"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:textColor="#111"
android:background="?android:attr/activatedBackgroundIndicator"
android:minHeight="?android:attr/listPreferredItemHeightSmall"/>

推薦答案

導(dǎo)航抽屜本質(zhì)上是一個列表視圖.使用您想要的任何布局(文本+圖像視圖)創(chuàng)建一個drawer_item.xml,并將其傳遞給arrayAdapter.然后在填充 listView 時(在 getview 方法中),將 imageView 分配給您選擇的可繪制對象.

The Navigation Drawer is essentially a list view. Create a drawer_item.xml with whatever layout you want (text+imageview) and pass it to the arrayAdapter. Then when populating the listView (in the getview method), assign the imageView to the drawable of your choosing.

這篇關(guān)于如何將圖標(biāo)添加到導(dǎo)航抽屜中的項目的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Java Remove Duplicates from an Array?(Java從數(shù)組中刪除重復(fù)項?)
How to fix Invocation failed Unexpected Response from Server: Unauthorized in Android studio(如何修復(fù)調(diào)用失敗來自服務(wù)器的意外響應(yīng):在 Android 工作室中未經(jīng)授權(quán))
AES encryption, got extra trash characters in decrypted file(AES 加密,解密文件中有多余的垃圾字符)
AES Error: Given final block not properly padded(AES 錯誤:給定的最終塊未正確填充)
Detecting incorrect key using AES/GCM in JAVA(在 JAVA 中使用 AES/GCM 檢測不正確的密鑰)
AES-256-CBC in Java(Java 中的 AES-256-CBC)
主站蜘蛛池模板: 久久99国产精品久久99果冻传媒 | 国产精品一区二 | 亚洲三区在线观看 | 精品区 | 欧一区| 日本高清在线一区 | 中文字幕一区二区三区不卡在线 | 亚洲一区二区精品视频 | 久草视频在 | 99自拍视频| 精品在线观看入口 | 亚洲国产一区二区在线 | 亚洲一区中文字幕 | 久久亚洲一区二区 | 黄网站免费在线观看 | 成人久久18免费网站图片 | 国产在线观 | 国产欧美视频一区二区三区 | 日日日操| 欧美久久久久久久久 | 99re在线视频 | 国产在线视频在线观看 | 中文字幕一区二区三区四区五区 | 成人午夜电影在线观看 | 亚洲国产成人av好男人在线观看 | 亚洲精品永久免费 | www.国产一区 | 亚洲欧美一区二区三区在线 | 91久久国产精品 | 亚洲精品中文字幕在线观看 | 国产伦一区二区三区视频 | 草久在线 | 午夜视频在线免费观看 | 九九热这里只有精品在线观看 | 国产精品免费观看 | 亚洲三级免费看 | 国产欧美日韩一区 | 久久久久久国产一区二区三区 | 一区二区三区免费在线观看 | 久久精品一级 | 91一区二区|