1
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

androidx.appcompat.widget.Toolbar のタイトルとアイコンの色を変える方法

Last updated at Posted at 2019-03-07

実装

activity_main.xml
<androidx.constraintlayout.widget.ConstraintLayout ..>
    <androidx.appcompat.widget.Toolbar
        android:id="@+id/toolbar"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:background="?attr/colorPrimary"
        app:theme="@style/ToolbarTheme" />
styles.xml
<resources>
    <style name="ToolbarTheme" parent="@style/ThemeOverlay.AppCompat.ActionBar">
        <!-- ToolBarのタイトルテキスト色 -->
        <item name="android:textColorPrimary">@color/colorWhite</item>
        <!-- iconの色 -->
        <item name="colorControlNormal">@color/colorWhite</item>
    </style>
</resources>

参考

1
4
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
1
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?