我想在Android中创建年度日历像ios
。Android的年度日历像IOS
如此照片。 与年份,月份和日期。
我这样做了2个listview和1个gridview,但是,我有年份项之间的差距。
50年.12个月与文本。
我想在Android中创建年度日历像ios
。Android的年度日历像IOS
如此照片。 与年份,月份和日期。
我这样做了2个listview和1个gridview,但是,我有年份项之间的差距。
50年.12个月与文本。
见这个例子..
https://github.com/ik024/CalendarLibrary
对于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"/>
在活动落实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
}
}
更多参考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 /布局/ 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>
或所有其他三个
我之前检查过这个github,但是。这个例子每个屏幕只有一年。每个可见视图只有12个月。不滚动,不像IOS一样 –
https://github.com/wasabeef/awesome-android-ui/blob/master/pages/Calendar.md
这些库可以帮助你实现你want.You可以尝试改变根据您的需要一些库。
不,不适合。 –
你想在一个屏幕上完整的输出? –
是啊,3个月的月份,每年有3 * 4个月等等。 –
只要做到这一点。什么问题? – Vyacheslav
我在年份项目之间有滞后。我有沉重的过程。 –
https://github.com/square/android-times-square –