本文实例为大家分享了Android自定义日历滑动控件的使用方法,供大家参考,具体内容如下
最近公司项目需要做这个需求,自己才疏学浅,总算能写出个大概来,遂在这里记录下来。
分析
先来分析一下:
首先,我们的需求是可以左右点击查看跳转到下一个月,中间的日历控件可以水平滚动选择日期,所以我们中间的日历控件用一个RecycleView来做,左右两位的为ImageVeiw。
LRCalendarView 总体流程:
1. R.layout.calendar_view
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#ffffff" android:padding="5dp" android:orientation="horizontal"> <ImageView android:id="@+id/iv_left" android:layout_gravity="center_vertical" android:src="@drawable/ic_launcher" android:layout_width="31dp" android:layout_height="31dp"/> <android.support.v7.widget.RecyclerView android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:id="@+id/recyclerView" android:layout_width="wrap_content" android:layout_weight="1" android:layout_height="50dp" android:layout_centerVertical="true" android:background="#ffffff" android:scrollbars="none" /> <ImageView android:id="@+id/iv_right" android:layout_gravity="center_vertical" android:src="@drawable/ic_launcher" android:layout_width="30dp" android:layout_height="30dp"/> </LinearLayout>
新闻名称:Android自定义日历滑动控件-创新互联
文章URL:https://www.cdcxhl.com/article32/dppcsc.html
成都网站建设公司_创新互联,为您提供外贸网站建设、外贸建站、电子商务、定制网站、软件开发、建站公司
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联