【问题标题】:Set Date range from a specific date instead of month in CalendarView在 CalendarView 中从特定日期而不是月份设置日期范围
【发布时间】:2021-01-07 01:16:51
【问题描述】:

https://github.com/kizitonwose/CalendarView

我一直在使用这个库来设置水平日历视图。在这个库中,他们像这样设置日期范围:-

  val currentMonth = YearMonth.now()
      
  binding.mainSingleRowCalendar.setup(
      currentMonth,
      currentMonth.plusMonths(2),
      DayOfWeek.values().random()
  )

这里使用月份来设置日期范围。我需要它是一个特定的日期。有什么解决办法吗? 我的实际要求是显示从当前日期起过去 30 天。

【问题讨论】:

    标签: android kotlin calendarview


    【解决方案1】:

    of(int year, int month) 方法

    从年份和月份中获取 YearMonth 的实例。

    YearMonth.of(2021,9) // Sample
    

    【讨论】:

    • 我需要指定日期
    猜你喜欢
    • 1970-01-01
    • 2017-02-23
    • 1970-01-01
    • 2016-05-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-19
    相关资源
    最近更新 更多