Jojo Narte
Jojo Narte

Reputation: 3104

Android: Customizing Calendar View style to show weekview

I created a view that has CalendarView added programatically.

Code:

CalendarView calendarView = new CalendarView(context);
calendarView.setDate(new Date().getTime());
cardInner.addView(calendarView);

http://www.screencast.com/t/ugGKqI2V0EH

The current set up is the one on the screenshot. I was wondering if there is a way to make it look this way? http://screencast.com/t/Q1kwyib0hOv

Upvotes: 0

Views: 686

Answers (1)

code_mc
code_mc

Reputation: 171

This is not possible using the CalendarView widget from AOSP. See https://developer.android.com/reference/android/widget/CalendarView.html

It is however possible to prevent the user from picking any date other than a date inside a certain week. You can achieve this by using the setMinDate and setMaxDate methods: https://developer.android.com/reference/android/widget/CalendarView.html#setMaxDate(long)

A third option would be extending the CalendarView widget and altering the onDraw method to only draw one row.

Also, try and search around on google. There might be a 3rd party library that can already do this.

Upvotes: 1

Related Questions