I'm trying to make a calendar, in which the days are in a RecyclerView.
I want to show the first day of the month on the column of the day of the week it starts on.
Is there a way to shift the items so that the first item starts on the right column?
Attached picture explains what I need.
You shouldn't care about the position in the column based on the day of the week.
One way is to have one Date instance for each day. To show one year in the above form you need to have a gridview 7x52. First cell in the gridview will have the first day of the year. The second day will go to the second position etc.. You can also extract from that the day of the month to produce the result you want.
You will need headers for that. Check this http://blog.sqisland.com/2014/12/recyclerview-grid-with-header.html
One way to create days for the adapter of your grid:
For every day out of the 365 {
Calendar newDay = Calendar.getInstance();
newDay.set(Year, 2016);
newDay.set(Calendar.Day_Of_Year, 0<i<365);
Arraylist adaptersData.add(newDay);
{
Related
I am little bit stuck and don't know to do. I have a Calendar View and wanna to change the color of day of week dynamically, in my case need to handle click on day of week. Below image what I am mean (sorry have only Russian version of example):
In above screenshot selected Tuesday an Thursday (week starts from Monday).
it seems like it is not quite possible. when you analyze the source code of SimpleMonthView which is the view used in CalendarView to draw each month, you can see that there is a stateMask (VIEW_STATE_ACTIVATED, VIEW_STATE_PRESSED) for days of Month but there isn't any stateMask for days of the week.
I would recommend to draw custom days of week view and overlap it with calendar view. I know it is not best solution
For example if I only want it to show ranges from 9am to 9pm? displayedCalendar property doesn't seem to change anything, only changed the displayed date.
Is this possible?
Right now there is only a week and day skin, showing both 24 hours. So the answer is: not at the moment.
I have searched in google and hunted in stackoverflow.com for a particular solution. The problem is that, I want to create a custom date picker. The date picker dialog will open up on click of a button with a custom tile bar and maybe a custom background. The most important customization will be the years showing up in the picker. What I want to do is, I will allow the users to select a date which is minimum 18 years old from today and it can go up to a maximum of 50 years. I have seen solutions to this problem which suggests to use view.updateDate on the datepicker to reset the datepicker inside the date range if the user tries to select anything out of the range. But, I do not want to even show the years which are not in the range. I only want the users to see the valid years from which he can select. The rest of the years should not even show up.
How can I customize the datepicker to give me the desired output?
Thhis one will helpfull to you.
DatePickerDialog dp = new DatePickerDialog(this,
datePickerListener, year, month, day);
long maxDate;
Date newDate = c.getTime();
dp.getDatePicker().setMinDate(newDate.getTime());
dp.getDatePicker().setMaxDate(maxDate);
Currently I'm using JXDatePicker from org.jdesktop.swingx.JXDatePicker; This is a code I applied on my picker to cross out some dates that I don't want the user to pick
picker.getMonthView().setUnselectableDates(dateArray);
But there is a problem, when the user starts to choose a date, and he clicked on the next month button which is located on the top left and top right corner of the date picker, the setUnselectableDates does not affect the next month.
What should I do in order to detect month change action or apply this to all the months in the picker?
Ok so say I'm doing an event scheduler and i have 3 combo boxes, first combo box is the month, the second is the date, and the third is the year. Is it possible using the Date Object in Java to have it automatically fill the options that you can select from?
The DateFormatSymbols class can be used to get the names of months you can use to fill in the combobox.
String months[]=(new DateFormatSymbols()).getMonths();
Don't forget that Java's months start with 0=January
The Calendar class can be used to determine the number of days in a given month, as well as the current year.
Calendar cal=Calendar.getInstance()
cal.setTime(System.currentTimeMillis() );
cal.set(Calendar.MONTH, Calendar.FEBRUARY);
int days=cal.getActualMaximum(Calendar.DAY_OF_MONTH);
Why do you want to use Date object to do that? if your goal is to fill all the months, days and several years in combo boxes then you can just add them directly in JCombo by using combo.addItem("<string value"). Hope this helps...
yes that possible, but that will be too hard job to synchronize all three JComboBoxes correctly for valid Year + Month + Day
if not Custom JCalendar (suggestion from your last post), then maybe JSpinner