You will need to create your own gridView. It might look something like this:
weekday layout
<GridView android:id="@+id/weekdays" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:clickable="false" android:numColumns="7" />
layout.xml for days
<GridView android:id="@+id/days" android:layout_width="wrap_content" android:layout_height="match_parent" android:numColumns="7" />
java code to display weekdays
GridView weekdays = (GridView) linearLayout.findViewById(R.id.weekdays); weekdays.setAdapter(new Weekdays()); public class WeekDays extends BaseAdapter { String[] weekdays = null; public WeekDayAdapter() { DateFormatSymbols dateFormatSymbols= new DateFormatSymbols(); weekdays = = dateFormatSymbols.getShortWeekdays(); } public int getCount() { return 7; } public Object getItem(int position) { return weekdays[position]; } public long getItemId(int position) { return GridView.INVALID_ROW_ID; } public View getView(int position, View convertView, ViewGroup parent) { View view = null; view = new LinearLayout(parent.getContext()); view.setLayoutParams(new GridView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); view.setOrientation(Horizontal); LinearLayout linearLayout = new LinearLayout(parent.getContext()); linearLayout.setOrientation(Vertical); TextView weekDays = new TextView(parent.getContext()); weekDays.setText(weekdays[position + 1]); linearLayout.addView(weekDays); view.addView(linearLayout); return view; } }
You can do something similar to set the days of the month. Feel free to ask any questions.
lokoko
source share