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

    如何將圖標添加到導航抽屜中的項目

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

    問題描述

    我希望在我的導航抽屜中的項目旁邊有圖標,我設置如下:

    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 中的文本視圖中,但我不知道該怎么做.實現這一目標的最佳方法是什么?

    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"/>
    

    推薦答案

    導航抽屜本質上是一個列表視圖.使用您想要的任何布局(文本+圖像視圖)創建一個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.

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

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

    相關文檔推薦

    Java Remove Duplicates from an Array?(Java從數組中刪除重復項?)
    How to fix Invocation failed Unexpected Response from Server: Unauthorized in Android studio(如何修復調用失敗來自服務器的意外響應:在 Android 工作室中未經授權)
    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)
    主站蜘蛛池模板: 成人精品在线视频 | 国产精品毛片一区二区在线看 | 中文字幕在线看第二 | 国产精品自产av一区二区三区 | 男人的天堂久久 | av在线播放网址 | 久草视频在线播放 | 在线视频一区二区 | 二区视频| 日韩久久综合网 | 国产高清无av久久 | 成人在线网址 | 日本小视频网站 | 欧美精品成人一区二区三区四区 | 亚洲欧美一区二区三区视频 | 欧美国产日韩一区二区三区 | 久久97精品 | 国产一区二区在线91 | 91在线视频观看 | 午夜伦理影院 | 亚洲一二三区免费 | 波多野结衣中文字幕一区二区三区 | 久久91 | 国产精品久久久久久吹潮 | 懂色av蜜桃av | 欧美日韩国产精品一区 | 亚洲性人人天天夜夜摸 | 黄色毛片免费看 | 国产91丝袜在线18 | 久久男人天堂 | 亚洲欧美在线免费观看 | 日韩欧美视频网站 | 日韩有码一区二区三区 | 亚洲欧美日韩精品久久亚洲区 | 日韩精品 | 国产高清视频一区 | 日韩国产免费观看 | 色综合桃花网 | 久久久激情 | 国产成人精品福利 | 亚洲欧美在线一区 |