2016-05-10 1 views
0

私はcolorPrimaryを濃い青色に設定したアプリを持っています。これで、AppBarとして使用するツールバーは暗い青色になり、私のテーマはTheme.AppCompat.Light.NoActionBarに基づいているので、AppBarのテキストはデフォルトではほぼ黒です。 textColorPrimaryの影響を受け、その副作用を制御する方法は何ですか?

<item name="android:textColorPrimary">@color/text_primary_default</item> 

しかし、結果として、今も私のナビゲーション引き出し内のテキストは、(ほぼ)白い背景に、白だけでなく、 textAppearanceLargeとTextViewsです:だから私は私のスタイルで、このような白に textColorPrimaryを設定します。

この問題を正しく解決するにはどうすればよいですか?ナビゲーションビュー、すべてのテキストビュー、そしてtextPrimaryColorの影響を受けるものには、異なるスタイル(暗いものはtextPrimaryColor)を設定するのが正しい方法だとは思えません。

答えて

0

のみ のxmlns使用navigationView中のTextViewの色を変更するには:それを将来

をカスタマイズするアプリ=「http://schemas.android.com/apk/res-auto」

や着色などstateColorListを

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
android:id="@+id/drawer_layout" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:fitsSystemWindows="true"> 

<!-- Other layout views --> 

<android.support.design.widget.NavigationView 
    android:id="@+id/nav_view" 
    android:layout_width="wrap_content" 
    android:layout_height="match_parent" 
    android:layout_gravity="start" 
    android:fitsSystemWindows="true" 
    app:itemTextColor="#009688" 
    app:headerLayout="@layout/nav_header" 
    app:menu="@menu/drawer_view" /> 

文書参照here

+1

これは2つの問題があります:1)それだけナビゲーションビューで色を変更し、BUテキストビューの色ではなく、textPrimaryColorが使用されている場合はどこでも使用できます。私はすべてのコントロールの色を(直接または別のスタイルで)設定しないようにしたい。 2)ナビゲーションビューでitemTextColorを設定するだけで、テキストは常にこの色になります。通常、チェックされたアイテムのアイコンのテキストの色と色は、primaryColorに変更されます。アイコンの色は変わりますが、itemTextColorが直接設定されている場合、この動作は無効になります。 – Naryoril

関連する問題