@Override public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) { LinearLayout ret = new LinearLayout(getContext()); ret.setOrientation(LinearLayout.VERTICAL); ret.setLayoutParams( new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); ret.setGravity(Gravity.CENTER); TextView textView = new TextView(getContext()); textView.setText( String.format("%d-%d", monthData.getDate().getYear(), monthData.getDate().getMonth())); ret.addView(textView); MonthView monthView = new MonthView(getContext()); monthView.setAdapter( new CalendarAdapter(getContext(), 1, monthData.getData()).setCellViews(cellView, markView)); ret.addView(monthView); return ret; }