我正在使用android的支持设计lib构建导航抽屉。我想自定义导航抽屉中显示的文字颜色,所以我用一种风格来做。
我的导航抽屉。
<android.support.design.widget.NavigationView
android:id="@+id/navigation_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
app:theme="@style/NavigationViewTheme"
app:headerLayout="@layout/drawer_header"
app:menu="@menu/menu_navigation" />
我的风格
<style name="NavigationViewTheme" parent="AppTheme">
<item name="textAppearanceListItem">@style/TextAppearance.AppCompat.Body2</item>
<!--CHANGE TEXT COLOR -->
<item name="android:textColorPrimary">@android:color/white</item>
<!-- CHANGE ICON COLOR -->
<item name="android:textColorSecondary">@android:color/white</item>
</style>
我现在想要改变的是突出显示的文字和图标的颜色。我尝试了很多项目,但没有任何改变。
我已尝试过所有这些
<item name="textColorPrimary">@color/primary_text_dark</item>
<item name="textColorSecondary">@color/secondary_text_dark</item>
<item name="textColorTertiary">@color/tertiary_text_dark</item>
<item name="textColorPrimaryInverse">@color/primary_text_light</item>
<item name="textColorSecondaryInverse">@color/secondary_text_light</item>
<item name="textColorTertiaryInverse">@color/tertiary_text_light</item>
<item name="textColorPrimaryActivated">@color/primary_text_dark</item>
<item name="textColorSecondaryActivated">@color/secondary_text_dark</item>
<item name="textColorPrimaryDisableOnly">@color/primary_text_dark_disable_only</item>
<item name="textColorPrimaryInverseDisableOnly">@color/primary_text_light_disable_only</item>
<item name="textColorPrimaryNoDisable">@color/primary_text_dark_nodisable</item>
<item name="textColorSecondaryNoDisable">@color/secondary_text_dark_nodisable</item>
<item name="textColorPrimaryInverseNoDisable">@color/primary_text_light_nodisable</item>
<item name="textColorSecondaryInverseNoDisable">@color/secondary_text_light_nodisable</item>
<item name="textColorHint">@color/hint_foreground_dark</item>
<item name="textColorHintInverse">@color/hint_foreground_light</item>
<item name="textColorSearchUrl">@color/search_url_text</item>
<item name="textColorHighlight">@color/highlighted_text_dark</item>
<item name="textColorHighlightInverse">@color/highlighted_text_light</item>
<item name="textColorLink">@color/link_text_dark</item>
<item name="textColorLinkInverse">@color/link_text_light</item>
<item name="textColorAlertDialogListItem">@color/primary_text_light_disable_only</item>
答案 0 :(得分:0)
我找到了解决方案。我只需要添加
<item name="colorPrimary">@android:color/holo_red_dark</item>
到我的导航抽屉式。