Android 月視圖控件:MonthView
用于Android開發中自定義的月歷視圖控件,使用簡單,可以很方便自定義各種漂亮的風格。適配器模式設計,性能優良。

XML中布局:
<com.zcw.widget.MonthView android:id="@+id/monthView1" android:padding="20dp" android:background="@drawable/dialog_full_holo_light" android:layout_width="wrap_content" android:layout_height="wrap_content" > </com.zcw.widget.MonthView>
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));
}
}); 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!