安卓日历开发源代码Word文件下载.docx
- 文档编号:18480642
- 上传时间:2022-12-17
- 格式:DOCX
- 页数:33
- 大小:25.07KB
安卓日历开发源代码Word文件下载.docx
《安卓日历开发源代码Word文件下载.docx》由会员分享,可在线阅读,更多相关《安卓日历开发源代码Word文件下载.docx(33页珍藏版)》请在冰豆网上搜索。
@+id/btn_back"
@style/TitleLeftButtonStyle"
/>
@+id/tv_top"
@style/TitleMiddleTextStyle"
text="
请选择日期"
@+id/btn_goback_to_today"
@style/TitleRightButtonStyle"
今天"
/LinearLayout>
53.0dip"
background="
#ff394147"
gravity="
center_vertical"
@+id/btn_prev_month"
0.0dip"
layout_weight="
0.2"
center"
@+id/left_img"
wrap_content"
@drawable/triangle06_states"
duplicateParentState="
true"
"
textSize="
16.0dip"
0.6"
@+id/tv_month"
xxxx年14月"
textColor="
#ffffffff"
21.0dip"
@+id/btn_next_month"
@+id/right_img"
@drawable/triangle05_states"
22.0dip"
#ff8091a8"
layout_gravity="
周日"
14.0dip"
周一"
周二"
周三"
周四"
周五"
周六"
GridView
@+id/gridview"
#00000000"
clickable="
clipChildren="
columnWidth="
55.0dip"
horizontalSpacing="
1.0dip"
listSelector="
@null"
numColumns="
7"
paddingBottom="
stretchMode="
columnWidth"
verticalSpacing="
】
xmlns:
#FFFFFF"
46dp"
55dp"
@+id/tvtext"
strong>
spanstyle="
font-size:
32px;
color:
#ff0000;
/span>
/strong>
/**
*日历gridview中的每一个item显示的textview
*@authorlmw
*
*/
publicclassCalendarAdapterextendsBaseAdapter{
privatebooleanisLeapyear=false;
//是否为闰年
privateintdaysOfMonth=0;
//某月的天数
privateintdayOfWeek=0;
//具体某一天是星期几
privateintlastDaysOfMonth=0;
//上一个月的总天数
privateContextcontext;
privateString[]dayNumber=newString[42];
//一个gridview中的日期存入此数组中
//privatestaticStringweek[]={"
"
};
privateSpecialCalendarsc=null;
privateLunarCalendarlc=null;
privateResourcesres=null;
privateDrawabledrawable=null;
privateStringcurrentYear="
;
privateStringcurrentMonth="
privateStringcurrentDay="
privateSimpleDateFormatsdf=newSimpleDateFormat("
yyyy-M-d"
);
privateintcurrentFlag=-1;
//用于标记当天
privateint[]schDateTagFlag=null;
//存储当月所有的日程日期
privateStringshowYear="
//用于在头部显示的年份
privateStringshowMonth="
//用于在头部显示的月份
privateStringanimalsYear="
privateStringleapMonth="
//闰哪一个月
privateStringcyclical="
//天干地支
//系统当前时间
privateStringsysDate="
privateStringsys_year="
privateStringsys_month="
privateStringsys_day="
publicCalendarAdapter(){
Datedate=newDate();
sysDate=sdf.format(date);
//当期日期
sys_year=sysDate.split("
-"
)[0];
sys_month=sysDate.split("
)[1];
sys_day=sysDate.split("
)[2];
}
publicCalendarAdapter(Contextcontext,Resourcesrs,intjumpMonth,intjumpYear,intyear_c,intmonth_c,intday_c){
this();
this.context=context;
sc=newSpecialCalendar();
lc=newLunarCalendar();
this.res=rs;
intstepYear=year_c+jumpYear;
intstepMonth=month_c+jumpMonth;
if(stepMonth>
0){
//往下一个月滑动
if(stepMonth%12==0){
stepYear=year_c+stepMonth/12-1;
stepMonth=12;
}else{
stepYear=year_c+stepMonth/12;
stepMonth=stepMonth%12;
//往上一个月滑动
stepYear=year_c-1+stepMonth/12;
stepMonth=stepMonth%12+12;
currentYear=String.valueOf(stepYear);
//得到当前的年份
currentMonth=String.valueOf(stepMonth);
//得到本月(jumpMonth为滑动的次数,每滑动一次就增加一月或减一月)
currentDay=String.valueOf(day_c);
//得到当前日期是哪天
getCalendar(Integer.parseInt(currentYear),Integer.parseInt(currentMonth));
publicCalendarAdapter(Contextcontext,Resourcesrs,intyear,intmonth,intday){
currentYear=String.valueOf(year);
//得到跳转到的年份
currentMonth=String.valueOf(month);
//得到跳转到的月份
currentDay=String.valueOf(day);
//得到跳转到的天
@Override
publicintgetCount(){
//TODOAuto-generatedmethodstub
returndayNumber.length;
publicObjectgetItem(intposition){
returnposition;
publiclonggetItemId(intposition){
publicViewgetView(intposition,ViewconvertView,ViewGroupparent){
if(convertView==null){
convertView=LayoutInflater.from(context).inflate(,null);
TextViewtextView=(TextView)convertView.findViewById(;
Stringd=dayNumber[position].split("
\\."
Stringdv=dayNumber[position].split("
SpannableStringsp=newSpannableString(d+"
\n"
+dv);
sp.setSpan(newStyleSpan(,0,d.length(),Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
sp.setSpan(newRelativeSizeSpan(1.2f),0,d.length(),Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
if(dv!
=null||dv!
="
){
sp.setSpan(newRelativeSizeSpan(0.75f),d.length()+1,dayNumber[position].length(),Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
//sp.setSpan(newForegroundColorSpan(Color.MAGENTA),14,16,Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
textView.setText(sp);
textView.setTextColor(Color.GRAY);
//if(position<
7){
////设置周
//textView.setTextColor(Color.WHITE);
//textView.setBackgroundColor(color.search_txt_color);
//textView.setTextSize(14);
//}
if(position<
daysOfMonth+dayOfWeek&
&
position>
=dayOfWeek){
//当前月信息显示
textView.setTextColor(Color.BLACK);
//当月字体设黑
drawable=res.getDrawable(;
if(schDateTagFlag!
=null&
schDateTagFlag.length>
0){
for(inti=0;
i<
schDateTagFlag.length;
i++){
if(schDateTagFlag[i]==position){
//设置日程标记背景
textView.setBackgroundResource(;
if(currentFlag==position){
//设置当天的背景
textView.setBackgroundDrawable(drawable);
textView.setTextColor(Color.WHITE);
returnconvertView;
//得到某年的某月
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 日历 开发 源代码