如何自定义颜色和日期范围选择器的其他内容?

问题描述 投票:0回答:1

如何仅在日期范围选择器中更改标题的颜色,我没有找到确切的方法,我只知道如何通过更改colorPrimary的颜色来更改所有日期范围选择器的颜色,这将更改颜色所有标题和所选日期中,我只想更改标题颜色

而且还有一种方法可以更改标题文本的大小,我知道我们可以更改标题,但可以更改标题大小吗?

这是我尝试过的风格

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/shamrock_green</item>
    <item name="colorPrimaryDark">@color/shamrock_green_dark</item>
    <item name="colorAccent">@color/shamrock_green</item>
    <item name="colorButtonNormal">@color/shamrock_green</item>
    <item name="colorOnSecondary">@color/white</item>
    <item name="colorOnSurface">@android:color/transparent</item>
    <item name="bottomSheetDialogTheme">@style/AppBottomSheetDialogTheme</item>
    <item name="materialCalendarFullscreenTheme">@style/CustomThemeOverlay_MaterialCalendar_Fullscreen</item>

</style>

<style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
    <item name="colorOnSurface">@android:color/black</item>
    <item name="colorPrimary">@color/black</item>
</style>

<style name="CustomThemeOverlay_MaterialCalendar_Fullscreen"
    parent="@style/ThemeOverlay.MaterialComponents.MaterialCalendar.Fullscreen">
    <item name="materialCalendarStyle">@style/Custom_MaterialCalendar.Fullscreen</item>
</style>
<style name="Custom_MaterialCalendar.Fullscreen"
    parent="@style/Widget.MaterialComponents.MaterialCalendar.Fullscreen">
    <item name="android:windowFullscreen">false</item>
    <item name="android:headerBackground">@color/shamrock_green</item>
</style>

<style name="ThemeMaterialCalendarButton" parent="Widget.MaterialComponents.Button.TextButton.Dialog">
    <item name="android:textColor">@color/shamrock_green</item>
</style>

<style name="ThemeMaterialCalendarTextButton" parent="Widget.MaterialComponents.Button.TextButton.Dialog.Flush">
    <item name="android:textColor">@color/shamrock_green</item>
    <item name="iconTint">@color/shamrock_green</item>
</style>

<style name="AppTheme.FullScreen" parent="@style/Theme.AppCompat">
    <item name="windowNoTitle">true</item>
    <item name="android:windowFullscreen">true</item>
</style>


</resources>

现在起作用的是它显示为对话框,而不是我想要的全屏显示,但是文本和背景颜色没有改变,唯一改变颜色的方法是改变诸如colorPrimary之类的颜色,这些颜色会影响所有应用程序

java android material-components-android daterangepicker
1个回答
0
投票

您可以使用主题叠加层:

© www.soinside.com 2019 - 2024. All rights reserved.