| AndBase开发框架 1.6

- 首页
- 相关页面
- 命名空间
- 类
- 文件

- 类列表
- 类索引
- 类继承关系
- 类成员

全部 类 命名空间 文件 函数 变量 枚举值 页
类 | Public 成员函数 | 静态 Public 属性 | Private 成员函数 | Private 属性 | 所有成员列表
com.ab.view.calendar.CalendarView类 参考
类 com.ab.view.calendar.CalendarView 继承关系图:

## 类
interface | AbOnItemClickListener

## Public 成员函数
| CalendarView (Context context)
| CalendarView (Context context, AttributeSet attrs)
void | initRow ()
void | setOnItemClickListener (AbOnItemClickListener mAbOnItemClickListener)
void | setHeaderHeight (int height)
void | setHeaderTextSize (int size)
void | rebuildCalendar (Calendar calendar)
void | setHeaderBackgroundResource (int resid)
String | getStrDateAtPosition (int position)
int | getCalendarCellSize ()
ArrayList< CalendarCell > | getCalendarCells ()
String | getCalSelected ()

## 静态 Public 属性
static Calendar | calStartDate = Calendar.getInstance()

## Private 成员函数
void | initStartDateForMonth ()
void | updateCalendar ()
void | initCalendar ()

## Private 属性
String | TAG = "CalendarView"
Context | context
LinearLayout.LayoutParams | layoutParamsFW = null
LinearLayout | mLinearLayoutHeader = null
LinearLayout | mLinearLayoutContent = null
CalendarHeader | mCalendarHeader = null
int | width = 320
int | height = 480
int | headerHeight = 45
int | rowHeight = 40
int | cellWidth = 40
Calendar | calToday = Calendar.getInstance()
Calendar | calSelected = null
Calendar | calCalendar = Calendar.getInstance()
int | currentMonth = 0
int | currentYear = 0
int | firstDayOfWeek = Calendar.SUNDAY
ArrayList< CalendarCell > | mCalendarCells = new ArrayList<CalendarCell>()
AbOnItemClickListener | mOnItemClickListener
AbOnItemClickListener | mOnDayCellClick

## 详细描述

© 2012 amsoft.cn 名称：CalendarView.java 描述：日历View

作者
  还如一梦中

版本
  v1.0

日期
  ：2013-8-23 下午2:03:29

## 构造及析构函数说明

com.ab.view.calendar.CalendarView.CalendarView | ( | Context | context | ) |
| inline

Instantiates a new ab grid view.

参数

  context | the context

com.ab.view.calendar.CalendarView.CalendarView | ( | Context | context,
|  | AttributeSet | attrs
| ) |  |
| inline

Instantiates a new calendar view.

参数

  context | the context
  attrs | the attrs

## 成员函数说明

ArrayList<CalendarCell> com.ab.view.calendar.CalendarView.getCalendarCells | ( |  | ) |
| inline

描述：获取当前日历的所有条目.

返回
  the calendar cells

int com.ab.view.calendar.CalendarView.getCalendarCellSize | ( |  | ) |
| inline

描述：获取这个日历的总日期数.

返回
  the calendar cell size

String com.ab.view.calendar.CalendarView.getCalSelected | ( |  | ) |
| inline

描述：获取选中的日期，默认为今天.

返回
  the cal selected

String com.ab.view.calendar.CalendarView.getStrDateAtPosition | ( | int | position | ) |
| inline

描述：根据索引获取选择的日期.

参数

  position | the position

返回
  the str date at position

void com.ab.view.calendar.CalendarView.initCalendar | ( |  | ) |
| inline private

描述：更新日历.

void com.ab.view.calendar.CalendarView.initRow | ( |  | ) |
| inline

Inits the row.

void com.ab.view.calendar.CalendarView.initStartDateForMonth | ( |  | ) |
| inline private

描述：由于日历上的日期都是从周日开始的，计算第一个单元格的日期.

void com.ab.view.calendar.CalendarView.rebuildCalendar | ( | Calendar | calendar | ) |
| inline

Rebuild calendar.

参数

  calendar | the calendar

void com.ab.view.calendar.CalendarView.setHeaderBackgroundResource | ( | int | resid | ) |
| inline

描述：设置标题背景.

参数

  resid | the new header background resource

void com.ab.view.calendar.CalendarView.setHeaderHeight | ( | int | height | ) |
| inline

Sets the header height.

参数

  height | the new header height

void com.ab.view.calendar.CalendarView.setHeaderTextSize | ( | int | size | ) |
| inline

Sets the header text size.

参数

  size | the new header text size

void com.ab.view.calendar.CalendarView.setOnItemClickListener | ( | AbOnItemClickListener | mAbOnItemClickListener | ) |
| inline

Sets the on item click listener.

参数

  mAbOnItemClickListener | the new on item click listener

void com.ab.view.calendar.CalendarView.updateCalendar | ( |  | ) |
| inline private

描述：更新日历.

## 类成员变量说明

Calendar com.ab.view.calendar.CalendarView.calCalendar = Calendar.getInstance()
| private

The cal calendar.

Calendar com.ab.view.calendar.CalendarView.calSelected = null
| private

The cal selected.

Calendar com.ab.view.calendar.CalendarView.calStartDate = Calendar.getInstance()
| static

The cal start date.

Calendar com.ab.view.calendar.CalendarView.calToday = Calendar.getInstance()
| private

The cal today.

int com.ab.view.calendar.CalendarView.cellWidth = 40
| private

The cell width.

Context com.ab.view.calendar.CalendarView.context
| private

The context.

int com.ab.view.calendar.CalendarView.currentMonth = 0
| private

The current month.

int com.ab.view.calendar.CalendarView.currentYear = 0
| private

The current year.

int com.ab.view.calendar.CalendarView.firstDayOfWeek = Calendar.SUNDAY
| private

The first day of week.

int com.ab.view.calendar.CalendarView.headerHeight = 45
| private

星期头的行高.

int com.ab.view.calendar.CalendarView.height = 480
| private

The height.

LinearLayout.LayoutParams com.ab.view.calendar.CalendarView.layoutParamsFW = null
| private

The layout params fw.

ArrayList<CalendarCell> com.ab.view.calendar.CalendarView.mCalendarCells = new ArrayList<CalendarCell>()
| private

The m calendar cells.

CalendarHeader com.ab.view.calendar.CalendarView.mCalendarHeader = null
| private

The m calendar header.

LinearLayout com.ab.view.calendar.CalendarView.mLinearLayoutContent = null
| private

The m linear layout content.

LinearLayout com.ab.view.calendar.CalendarView.mLinearLayoutHeader = null
| private

The m linear layout header.

AbOnItemClickListener com.ab.view.calendar.CalendarView.mOnDayCellClick
| private

初始值:
= new AbOnItemClickListener(){
@Override
public void onClick(int position) {
CalendarCell mCalendarCell = mCalendarCells.get(position);
if(mCalendarCell.isActiveMonth()){
calSelected.setTimeInMillis(mCalendarCell.getThisCellDate().getTimeInMillis());
for(int i=0;i<mCalendarCells.size();i++){
CalendarCell mCalendarCellOther = mCalendarCells.get(i);
mCalendarCellOther.setSelected(false);
}
mCalendarCell.setSelected(true);
if(mOnItemClickListener!=null){
mOnItemClickListener.onClick(position);
}
}
}
}

点击日历，触发事件.

AbOnItemClickListener com.ab.view.calendar.CalendarView.mOnItemClickListener
| private

The m on item click listener.

int com.ab.view.calendar.CalendarView.rowHeight = 40
| private

The row height.

String com.ab.view.calendar.CalendarView.TAG = "CalendarView"
| private

The tag.

int com.ab.view.calendar.CalendarView.width = 320
| private

The width.

该类的文档由以下文件生成:

- src/com/ab/view/calendar/CalendarView.java