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
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.
Related
I'm trying to build a custom datepicker dialog. I used CalendarView instead of DatePicker since I didn't want the header used in DatePicker. This is how it looks now.
And this is what I want to achieve.
The future and previous dates should be visible. If clicked on future month's date, calendar should scroll to next month.
I couldn't find any properties/functions in CalendarView class to achieve this. Is there any other way to achieve this? Is there any 3rd party open-source library that does this?
I want to show a user with a calendar where multiple dates are selected.
While this could be easily achieved using Material Calendar View but I prefer not to use dependency for this simple task.
How could I achieve this by extending android CalendarView?
Please help
I would refer you to a comment on How to highlight multiple dates in Android CalendarView.
It basically says CalendarView does not support this, and that the point of CalendarView is to allow the user to choose a date.
Good luck!
I am making an attendance app i want to highlight multiple dates where student is absent and also make calendar view not clickable.
only want to show calendar.
This question doesn't look, you have done any research.
However, you can use https://github.com/Applandeo/Material-Calendar-View
Pros:
Easily customizable. [I have used in 3-4 projects so far]
Fits in requirement like range picker, one-day selection (event based)
Lightweight library, few files/ less code. You can also strip off the unnecessary code of range picker and other if you want. As for me, the requirement was only One-day-picker
i want to highlight multiple dates where student is absent
You can create a list of object of EventDay which take the Calendar instance. You can pass it to the CalendarView. It will show the different event aka absentees in your case.
make calendar view not clickable
That's not the big deal, You can easily do that as CalendarView is a custom view itself.
This is my latest screenshot from one of my project. It work really well.
I want to disable past time numbers in TimePicker. In DatePicker there is a special property for disabling past dates and there is no one for TimePicker so I need to extend an original TimePicker. As I understand I need to change a layout. How to get access to the layout?
Important: android/frameworks/base/core/res/res/layout/time_picker.xml is not an answer - it has got a reference to TimePicker widget where there are no links to other layout files.
Instead of extending a timepicker, extend from dialogfragment and on your onCreateDialog() method return a timepocker dialog. Also remember to implement OnTimeChangedListener so that you can validade the selected date as you need. If you're creating a picker thats gonna be used throughout your whole application you should also consider overriding onDismiss() and then pass the selected date to the activity which started it. Hope this helps
i want to create a view just like image. How can i accomplish this.I have seach about this but not able to create just like this view. Can any body help me.
I have create the calender but the unable to show the bars
Thanks
You can use Yadview library from this link : https://code.google.com/p/yadview
It loads, lays out and displays events. yadview is intended to be more robust in handling of events from various sources, rendering differently.
It works really good for me!
there is a library that you can use:
https://github.com/roomorama/Caldroid
Embedded as a fragment or shown as dialog
Set min/max date. The date outside min/max range is marked as disabled
Set disabled dates
Select dates fromDate to toDate
Client can listen to various events when user interacts with Calendar
Customize look and feel