当前位置: 软件>java软件
Android 月视图控件 MonthView
本文导语: 用于Android开发中自定义的月视图控件,使用简单,可以很方便自定义各种漂亮的风格。XML中布局: java代码:monthView.setAdapter(new MonthAdapter() { @Override public View createCellView(ViewGroup viewGroup, int position) ...
用于Android开发中自定义的月视图控件,使用简单,可以很方便自定义各种漂亮的风格。
XML中布局:
java代码:
monthView.setAdapter(new MonthAdapter() { @Override public View createCellView(ViewGroup viewGroup, int position) { TextView textView = new TextView(getContext()); textView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); textView.setGravity(Gravity.CENTER); return textView; } @Override public void bindCellView(ViewGroup viewGroup, View child, int position, Calendar calendar) { TextView textView = (TextView) child; textView.setText(""+calendar.get(Calendar.DAY_OF_MONTH)); } });