[英]Android yearly calendar like IOS
i want to create yearly calendar in Android like ios
. 我想像
ios
这样在Android中创建年度日历 。
such as this photo . 例如这张照片。 with year , month and date .
年,月,日。
i do it with 2 listviews and 1 gridview but , i have lag between year items . 我用2个listviews和1个gridview来做,但是,我在年度项目之间有滞后。
for 50 years .with 12 month with text . 为期50年。有12个月的文字提示。
https://github.com/wasabeef/awesome-android-ui/blob/master/pages/Calendar.md https://github.com/wasabeef/awesome-android-ui/blob/master/pages/Calendar.md
these libraries might help you in achieving what you want.You can try altering some of these libraries according to your need. 这些库可能会帮助您实现所需的功能。您可以尝试根据需要更改其中一些库。
See this example.. 请参见此示例。
https://github.com/ik024/CalendarLibrary https://github.com/ik024/CalendarLibrary
For YearView (this show two columns please check this code how to set the two columns than you fulfill your requirement) 对于YearView(此显示两列,请检查此代码如何设置两列,以确保您不满足要求)
Add the following in your xml file: 在您的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"/>
Implement the YearViewClickListener in your Activity: 在您的活动中实现YearViewClickListener:
public class MonthViewDemo extends AppCompatActivity implements YearViewClickListeners{
@Override
public void dateClicked(int year, int month, int day) {
Toast.makeText(this, "year: "+year+";\nmonth: "+month+";\nday: "+day, Toast.LENGTH_LONG).show();
//TODO: Perform your actions based on year or month or day clicked
}
}
For more refer YearViewDemo.java file. 有关更多信息,请参考YearViewDemo.java文件。
Customizations 自定义
Following attributes can be customized: 可以自定义以下属性:
<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" />
For three columns you need to change 对于三列,您需要更改
go to calendarlib/layout/yearView.xml 转到calendarlib / layout / yearView.xml
do this... and make all change according to you responsive or etc.. 这样做...并根据您的需要做出所有更改,等等。
<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>
or all other in three 或其他三分之二
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.