gpt4 book ai didi

java - Android CalendarView 年份文本颜色

转载 作者:行者123 更新时间:2023-12-01 17:03:26 26 4
gpt4 key购买 nike

我正在 Android Studio 中设计 CalendarView 的样式,并且我已经实现了更改所选颜色

使用以下代码:

布局:

<CalendarView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/CalenderViewCustom"
android:dateTextAppearance="@style/CalenderViewDateCustomText"
android:weekDayTextAppearance="@style/CalenderViewWeekCustomText">
</CalendarView>

样式.xml:

<style name="CalenderViewCustom" parent="Theme.AppCompat">
<item name="colorAccent">@color/mainSelectedColor</item>
</style>

<style name="CalenderViewDateCustomText" parent="android:TextAppearance.DeviceDefault.Small">
<item name="android:textColor">@color/colorBlack</item>
</style>

<style name="CalenderViewWeekCustomText" parent="android:TextAppearance.DeviceDefault.Small">
<item name="android:textColor">@color/colorBlack</item>
</style>

问题是我的结果没有像您在结果中看到的那样显示年份和月份:

enter image description here

我已经尝试更改 headerMonthTextApperance 等 header 属性,但似乎没有任何效果。

最佳答案

嗨,你不能使用这个库

https://github.com/SundeepK/CompactCalendarView

全面的性能和可定制

<com.github.sundeepk.compactcalendarview.CompactCalendarView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/compactcalendar_view"
android:layout_width="fill_parent"
android:paddingRight="10dp"
android:paddingLeft="10dp"
android:layout_height="250dp"
app:compactCalendarTargetHeight="250dp"
app:compactCalendarTextSize="12sp"
app:compactCalendarBackgroundColor="#ffe95451"
app:compactCalendarTextColor="#fff"
app:compactCalendarCurrentSelectedDayBackgroundColor="#E57373"
app:compactCalendarCurrentDayBackgroundColor="#B71C1C"
app:compactCalendarMultiEventIndicatorColor="#fff"
/>

关于java - Android CalendarView 年份文本颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61483712/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com