質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
XML

XMLは仕様の1つで、マークアップ言語群を構築するために使われています。

Android

Androidは、Google社が開発したスマートフォンやタブレットなど携帯端末向けのプラットフォームです。 カーネル・ミドルウェア・ユーザーインターフェイス・ウェブブラウザ・電話帳などのアプリケーションやソフトウェアをひとつにまとめて構成。 カーネル・ライブラリ・ランタイムはほとんどがC言語/C++、アプリケーションなどはJavaSEのサブセットとAndroid環境で書かれています。

Kotlin

Kotlinは、ジェットブレインズ社のアンドリー・ブレスラフ、ドミトリー・ジェメロフが開発した、 静的型付けのオブジェクト指向プログラミング言語です。

Q&A

解決済

1回答

1048閲覧

androidx.drawerlayout.widget.DrawerLayoutでAppberのtitleColorが変更できない

Michy

総合スコア13

XML

XMLは仕様の1つで、マークアップ言語群を構築するために使われています。

Android

Androidは、Google社が開発したスマートフォンやタブレットなど携帯端末向けのプラットフォームです。 カーネル・ミドルウェア・ユーザーインターフェイス・ウェブブラウザ・電話帳などのアプリケーションやソフトウェアをひとつにまとめて構成。 カーネル・ライブラリ・ランタイムはほとんどがC言語/C++、アプリケーションなどはJavaSEのサブセットとAndroid環境で書かれています。

Kotlin

Kotlinは、ジェットブレインズ社のアンドリー・ブレスラフ、ドミトリー・ジェメロフが開発した、 静的型付けのオブジェクト指向プログラミング言語です。

0グッド

0クリップ

投稿2021/02/05 10:49

やりたいこと

AndroidアプリでAppberの色を白色にし、Appberのアイコンやタイトルを黒色にしたい

実施したこと、現在の状態

colorPrimaryを設定することでAppberの色を白くはできたのですが、
colorOnPrimaryの色がAppberのTitleに反映されずタイトルが見えない状態になってしまいます。

おそらくcolorOnPrimary以外の色があたってしまっているようなのですが、該当の箇所がわからず詰まってしまっております。

TitleColorの変更方法はどのようにすればよいのでしょうか?

themes.xml

xml

1<resources xmlns:tools="http://schemas.android.com/tools"> 2 <!-- Base application theme. --> 3 <style name="Theme.Richnote" parent="Theme.MaterialComponents.DayNight.DarkActionBar"> 4 5 <!-- Primary brand color. --> 6 <item name="colorPrimary">#FFFFFFFF</item> 7 <item name="colorPrimaryVariant">@color/purple_700</item> 8 <item name="colorOnPrimary">#FF000000</item> 9 10</resources>

activity_main.xml

xml

1<?xml version="1.0" encoding="utf-8"?> 2 3<!--the root view must be the DrawerLayout--> 4<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" 5 xmlns:app="http://schemas.android.com/apk/res-auto" 6 xmlns:tools="http://schemas.android.com/tools" 7 android:id="@+id/my_drawer_layout" 8 android:layout_width="match_parent" 9 android:layout_height="match_parent" 10 tools:context=".MainActivity" 11 tools:ignore="HardcodedText"> 12 13 <FrameLayout 14 android:layout_width="match_parent" 15 android:layout_height="match_parent"> 16 17 18 19 <com.google.android.material.floatingactionbutton.FloatingActionButton 20 android:id="@+id/fab" 21 android:layout_width="wrap_content" 22 android:layout_height="wrap_content" 23 android:layout_margin="16dp" 24 app:srcCompat="@drawable/ic_baseline_create_24" 25 android:layout_gravity="end|bottom" 26 android:contentDescription="TODO" /> 27 28 </FrameLayout> 29 30 31 <com.google.android.material.navigation.NavigationView 32 android:layout_width="wrap_content" 33 android:layout_height="match_parent" 34 android:layout_gravity="start" 35 app:menu="@menu/navigation_menu" /> 36 37 38</androidx.drawerlayout.widget.DrawerLayout>

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

actionBarTheme というのを設定すると良いようです。
参考: java - How to change Actionbar text color using Material Design? - Stack Overflow

xml

1 <style name="Theme.Richnote" parent="Theme.MaterialComponents.DayNight.DarkActionBar"> 2 <!-- 略 --> 3 4 <!-- これを追加 --> 5 <item name="actionBarTheme">@style/ThemeOverlay.Actionbar</item> 6 </style> 7 8 <!-- これを追加 --> 9 <style name="ThemeOverlay.Actionbar" parent="ThemeOverlay.MaterialComponents.Dark.ActionBar" > 10 <item name="android:textColorPrimary">#FF000000</item> 11 </style>

投稿2021/02/06 00:27

hoshi-takanori

総合スコア7895

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問