Android 公历农历

SolarLunarView

公历农历 - 日历View
1.显示中国节假日
2.公历
3.农历

预览

在这里插入图片描述

资源

名字资源
AARsolar_lunar_view.aar
GiteeSolarLunarView
GitHubSolarLunarView

Maven

1.build.grade | setting.grade

repositories {
	...
	maven { url 'https://jitpack.io' }
}

2./app/build.grade

dependencies {
	implementation 'com.github.RelinRan:SolarLunarView:2022.6.9.1'
}

xml

<com.androidx.widget.SolarLunarView
    android:layout_width="match_parent"
    android:background="@android:color/white"
    android:layout_height="350dp"/>

attr.xml

<attr name="solarYear" format="integer" />
<attr name="solarMonth" format="integer" />
<attr name="solarDay" format="integer" />
<attr name="dayRadius" format="dimension|float" />
<attr name="solarTextSize" format="dimension|float|reference" />
<attr name="solarTextColor" format="color|reference" />
<attr name="lunarTextSize" format="dimension|float|reference" />
<attr name="lunarTextColor" format="color|reference" />
<attr name="LunarMarginTop" format="dimension|reference" />
<attr name="titleTextSize" format="dimension|reference" />
<attr name="titleMarginTop" format="dimension|reference" />
<attr name="titleMarginBottom" format="dimension|reference" />
<attr name="selectBackgroundColor" format="color|reference" />
<attr name="selectSolarTextColor" format="color|reference" />
<attr name="selectLunarTextColor" format="color|reference" />
<attr name="titleTextColor" format="color|reference" />
<attr name="gradientStartColor" format="color|reference" />
<attr name="gradientEndColor" format="color|reference" />
<attr name="titleBackgroundColor" format="color|reference" />

使用

SolarLunarView solar_lunar = findViewById(R.id.solar_lunar);
solar_lunar.setYear(2022);
solar_lunar.setMonth(6);
solar_lunar.setDay(5);
solar_lunar.setOnItemClickListener(new SolarLunarView.OnItemClickListener() {
    @Override
    public void onItemClickListener(SolarLunarView view, Date time) {
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        String date = format.format(time);
    }
});
  • 8
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值