您好,欢迎访问成都祈钰瑶科技有限公司!

全国咨询热线

18982081108
✕

成都网站建设公司,成都网站UI设计,成都网站安全维护,成都网站内容优化服务

Android自定义wheelview实现滚动日期选择器-创新互联

本文实例为大家分享了Android实现滚动日期选择器的具体代码,供大家参考,具体内容如下

创新互联提供成都网站建设、成都网站制作、网页设计,成都品牌网站建设,广告投放等致力于企业网站建设与公司网站制作,十年的网站开发和建站经验,助力企业信息化建设,成功案例突破成百上千家,是您实现网站建设的好选择.

wheelview滚动效果的View

这段时间需要用到一个时间选择器,但是不能使用日期对话框,
因为它是筛选条件框架下的,只能是View!这个WheelView改造后可以达到要求!
这个wheelview框架使用的类不多,就几个,还有一些资源文件。
我根据这个框架设计了日期的选择器。

主页面:

第一种日期选择器页面:

动态效果:

使用:

具体的实现是一个LoopView的类,这是一个继承View的类!
理解LoopView的公开方法就可以了。

1.布局文件

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
       xmlns:app="http://schemas.android.com/apk/res-auto"
       android:orientation="vertical"
       android:layout_width="match_parent"
       android:layout_height="match_parent"
       android:background="#fff"
    >

  <com.example.wheelview.loopview.LoopView
    android:layout_marginTop="50dp"
    android:id="@+id/loopView"
    android:layout_width="match_parent"
    android:layout_height="150dp"
    app:awv_textsize="18"
    />

</LinearLayout>