How to change toolbar text color from MaterialComponents.DayNight theme?

后端 未结 5 1687
萌比男神i
萌比男神i 2021-02-20 17:58

I am using MaterialComponents.DayNight theme in my app. In the day mode, toolbar text color is black. But when I switch to night mode toolbar text color is remain black, so it\'

5条回答
  •  滥情空心
    2021-02-20 18:17

    Just use in your Layout (it works also with the androidx.appcompat.widget.Toolbar) the style:

    Then define in the values-night/colors.xml the colorOnPrimary.

    Then there are a lot of alternatives.
    You can customize globally the style of the toolbar in the app theme with:

    
    

    with:

      
    

    and the define the color in the values/colors.xml and values-night/colors.xml.

    Or just apply a style in the Toolbar

    or simply override the theme with:

    with:

      
    

提交回复
热议问题