2017-08-24 103 views
0

我在抽屜式導航菜單的一組項目:如何更改Android中導航抽屜中的項目標題背景?

<menu xmlns:android="http://schemas.android.com/apk/res/android"> 
    <item android:title="Group Title"> 
     <menu> 
      <group android:checkableBehavior="single"> 

       <item 
        android:id="@+id/nav_camera" 
        android:icon="@drawable/ic_star_black_24dp" 
        android:title="Import" /> 
       <item 
        android:id="@+id/nav_gallery" 
        android:icon="@drawable/ic_share_black_24dp" 
        android:title="Gallery" /> 
      </group> 
     </menu> 
    </item> 
</menu> 

我設法樣式的菜單項,從堆棧溢出this post的指令之後。基本上,修改這三個屬性:

這工作得很好,除了它只是風格,在標籤內的物品:

enter image description here

所以我的問題是:我怎麼能款式(顏色和背景)標題(「Show Apps」和「其他」)?

回答

0

附加以下的styles.xml

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> 
     <item name="android:itemBackground">#00F</item> 
     <item name="android:itemTextAppearance">@style/TextAppearance</item> 
    </style> 

    <style name="TextAppearance"> 
     <item name="android:textColor">#F00</item> 
    </style> 

改變第一行的「名稱」和「父」與您的應用程序的默認代碼