I'm using Material Design Date picker: https://material.io/components/date-pickers in my Android Application, can I make every date in calendar to have different color?
enter image description here
There is a calendar and Showing Icons in marked dates
Im using a DatePickerDialog on my app, and when it shows it looks like this
Im trying to change the look of it, to look like this one
This is how i declare my picker:
DatePickerDialog datepicker = new DatePickerDialog(getActivity(),
AlertDialog.THEME_DEVICE_DEFAULT_LIGHT,this,year,month,day);
According to a tutorial i was reading, if we pass AlertDialog.THEME_DEVICE_DEFAULT_LIGHT it should display the calendar like i want, but it does not work. Do i need something else?
Edit
Seems it might be an issue with Huawei(brand of the phone i was using) according to this
From the official docs -
When the DatePicker_datePickerMode attribute is set to calendar, the month and day can be selected using a calendar-style view while the year can be selected separately using a list.
According to datePickerMode doc -
Prior to the L release, the only choice was spinner. As of L, with the Material theme selected, the default layout is calendar.
So, if you are using the material theme in your Activity, then pass 0 in themeResId. This will make the dialog use the parent context's default alert dialog theme.
DatePickerDialog datepicker = new DatePickerDialog(getActivity(),
0 ,this,year,month,day);
Otherwise, you can use Theme_Material_Dialog_Alert or Theme_Material_Light_Dialog_Alert.
DatePickerDialog datepicker = new DatePickerDialog(getActivity(),
R.style.THEME_DEVICE_DEFAULT_LIGHT,this,year,month,day);
I am looking for way to get a calendar view with Event added on specific date something like the below:
And when I click on the calendar date another activity has to be opened?
Can the default calendar View help me doing the same or is there any other API that can help get the result like above?
Let me know!
Thanks!
You can use default calender library like
CalendarView
or you can use Caldroid
You can use default calendarview, I have used material calendarview for similar result.
You can even add events in text form as well as you can show drawable images with texts there.
See the line of code:
List<EventDay> events = new ArrayList<>();
events.add(new EventDay(calendar, CalendarUtils.getDrawableText(this, "₹"+wonAmt, Typeface.DEFAULT_BOLD, R.color.green, 8)));
I am using two time pickers to set a start time and an end time. But in some devices I am facing a problem that both time picker alignments are not the same. The selected time in both the time pickers show the text but they're not properly aligned.
I have also seen my layouts but they are all correct. The biggest thing is that I am facing this problem in some of the devices not in every device.
My Layout xml is:
https://docs.google.com/document/d/12zYYIDHTK3AgN_0OSkAzLvFVcpVpdlYt5lSPDIYqg7M/edit?usp=sharing
I am facing this problem in samsung galaxy tab 3.
The xml layout you give us has 2 NumberPicker elements with visibility "gone"
I presume that at some point you make the third NumberPicker visible.
In the above case the second NumberPicker has
android:gravity="center"
android:layout_gravity="center"
and the third does not. This might be causing you the alignment problem