Android开发——带价格的自定义日历

本文介绍了在Android开发中,由于时间紧迫,作者选择了一个基础日历控件进行二次封装,以满足带有价格显示的需求。文章提供了详细的步骤,包括添加依赖、布局设计、数据初始化和点击事件的设置,旨在帮助其他开发者快速实现类似功能。
摘要由CSDN通过智能技术生成

  最近开发中需要好多各式各样的控件,其中就有一个是日历控件,网络上的自定义日历控件质量参差不齐,看了好多发现源码中都有bug,加上时间比较紧张,就找了一个普通的日历控件,二次封装了一下,希望能给大家提供帮助。(PS:原谅我技术不太好QAQ,但我觉得应该勉强能入眼吧)

//因为是公司项目不方便给大家放项目源码,所以我尽量写的详细一点QAQ  给你们看下效果图,可以左右滑动切换月份

//导入一个依赖

compile 'com.github.codbking:CalendarExaple:v1.0.0'

//放这部分布局  CardView是那个外面的圆角布局 

                <android.support.v7.widget.CardView
                    android:layout_width="335dp"
                    android:layout_height="wrap_content"
                    android:layout_centerHorizontal="true"
                    android:layout_marginTop="25dp"
                    app:cardCornerRadius="14dp"
                    app:cardElevation="10dp"
                    android:layout_gravity="center">
                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:orientation="vertical">
                        <RelativeLayout
                            android:layout_width="match_parent"
                            android:layout_height="44dp">
                            <TextView
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="选择出行日期"
                                android:layout_centerVertical="true"
                                android:layout_marginLeft="15dp"
                                android:textColor="@color/gray_B1"
                                android:textSize="@dimen/text_12_sp"/>
                        </RelativeLayout>
                        <View
                            android:layout_width="match_parent"
                            android:layout_height="1dp"
                            android:background="@color/gray_E2E3E7"/>
                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:orientation="horizontal"
                            android:layout_marginTop="15dp">
                            <LinearLayout
                                android:layout_width="18dp"
                                android:layout_height="wrap_content"
                                android:gravity="center_vertical"
                                android:orientation="horizontal">
                                <TextView
                                    android:id="@+id/title"
                                    android:layout_width="0dp"
                                    android:layout_height="match_parent"
                                    android:layout_weight="1"
                                    android:gravity="center"
                                    android:text="2016/10/10"
                                    android:textColor="#000"
                                    android:textSize="8sp"/>
                            </LinearLayout>

                      
  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值