类似IOS的Android年度日历
我想在Android中创建年度日历,就像类似IOS的Android年度日历,android,ios,iphone,calendar,android-calendar,Android,Ios,Iphone,Calendar,Android Calendar,我想在Android中创建年度日历,就像ios一样 比如这张照片。 带有年、月和日期 我用2个ListView和1个gridview来做,但是,我在年份项目之间有延迟 50年,12个月,带文字 这些库可能会帮助您实现所需。您可以尝试根据需要更改其中的一些库 请参见此示例 对于YearView(显示两列,请检查此代码如何设置这两列,以满足您的要求) 在xml文件中添加以下内容: <com.github.ik024.calendar_lib.YearView android
ios
一样
比如这张照片。
带有年、月和日期
我用2个ListView和1个gridview来做,但是,我在年份项目之间有延迟
50年,12个月,带文字
这些库可能会帮助您实现所需。您可以尝试根据需要更改其中的一些库 请参见此示例 对于YearView(显示两列,请检查此代码如何设置这两列,以满足您的要求) 在xml文件中添加以下内容:
<com.github.ik024.calendar_lib.YearView
android:id="@+id/calendar_year_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"/>
有关更多信息,请参阅YearViewDemo.java文件
定制
可以自定义以下属性:
<attr name="currentDayTextColorYV" format="color"/>
<attr name="monthNameTextColorYV" format="color"/>
<attr name="daysOfMonthTextColorYV" format="color"/>
<attr name="daysOfWeekTextColorYV" format="color"/>
<attr name="eventDayBackgroundColorYV" format="color"/>
<attr name="eventDayTextColorYV" format="color"/>
<attr name="calendarBackgroundColorYV" format="color" />
<attr name="monthNameBackgroundColorYV" format="color" />
<attr name="displayYearTextColorYV" format="color" />
<attr name="headerBackgroundColorYV" format="color" />
<attr name="prevButtonBackgroundResourceYV" format="reference" />
<attr name="nextButtonBackgroundResourceYV" format="reference" />
对于三列,您需要进行更改
转到calendarlib/layout/yearView.xml
做这个。。。并根据您的反应等做出所有更改
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1">
<com.github.ik024.calendar_lib.custom.MonthView
android:id="@+id/mv_year_view_jan"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.33" />
<com.github.ik024.calendar_lib.custom.MonthView
android:id="@+id/mv_year_view_feb"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.33" />
<com.github.ik024.calendar_lib.custom.MonthView
android:id="@+id/mv_year_view_march"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.33" />
</LinearLayout>
或者其他三种方法都可以就这么做吧。有什么问题吗?我有一个年与年之间的项目。我有一个繁重的过程。@Er.Arjunsaini,我想要3列的月,你的链接不合适。@adnan9011试试我的答案玩这个代码,三列检查两列很好:)编码快乐你想要在一个屏幕上完整输出吗?是的,3列的月,ech年有3*4个月等等。我以前检查过这个github,但是。这个例子每个屏幕只有一年的时间。每个可见视图仅12个月。不滚动,不像IOS那样按年滚动
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1">
<com.github.ik024.calendar_lib.custom.MonthView
android:id="@+id/mv_year_view_jan"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.33" />
<com.github.ik024.calendar_lib.custom.MonthView
android:id="@+id/mv_year_view_feb"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.33" />
<com.github.ik024.calendar_lib.custom.MonthView
android:id="@+id/mv_year_view_march"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.33" />
</LinearLayout>