LoginSignup
15
15

More than 5 years have passed since last update.

NavigationDrawerのアイコン色を変更する

Posted at

Androidアプリのホーム画面によく使用する、NavigationDrawerの三本線アイコン(ハンバーグアイコン)の色を変更する方法です。

DrawerToggle.png

カスタムテーマを作成する

アイコン色の設定はここで行います。drawerArrowStyle属性で設定するので、下記のように記述します。
既に使用しているテーマがある場合は、drawerArrowStyeを追記する。

styles.xml
    <style name="MyCustomTheme" parent="@style/Theme.AppCompat.Light">
        <item name="drawerArrowStyle">@style/CustomDrawerArrowStyle</item>
    </style>

    <style name="CustomDrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">
        <item name="color">#0000ff</item>
    </style>

カスタムテーマを使用するようにAndroidManifestに記述する

applicationタグの属性に追記。既にテーマを指定している場合は設定不要です。

AndroidManifest.xml
   <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/MyCustomTheme">

       ~~~

    </application>       

おわり!

DrawerToggle2.png

15
15
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
15
15