I made a custom DatePicker that extends the android DatePicker UI component. I needed this to make possible the visibility option for each DatePicker's view component(day,month and year).
I made this possible by hiding the views from DatePicker by its index.
I get the index of each component by getting the date format order like this DateFormat.getDateFormatOrder(context) , this returns a char array like {m, d, y} so I can get the order of the DatePicker components and hide them..
The problem I run into is that on some devices the DatePicker position its components by the selected locale of the user and not by the selected date format.
How can I get the DatePicker's components order? Or how I can figure out that DatePicker will position its components by locale or date format?
Note that I am developing this on Android API level 2.1++ and I would prefer not to make my own DatePicker so I can preserve the android DialogPicker UI theme.
Thank you!
And unfortunately the answer is: I had to develop my own DatePicker and now everything works fine
Related
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 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.
In my application I need to have a EditText where the values are numbers. I need to increase the value of EditText by scrolling up and need to decrease the value of EditText by scrolling down.
Example : DatePicker
The date changes by scrolling up and down. I need to have a EditText like in DatePicker.
Thanks in advance.
After some deep testing and using, this is a list of usable Picker widget libraries
Android Wheel http://code.google.com/p/android-wheel/
Number Picker from https://github.com/mrn/numberpicker
Date Slider (which can be easily adjusted) http://code.google.com/p/android-dateslider/
Horizontal slider widget http://blog.sephiroth.it/2012/01/28/android-wheel-widget/
Backport of Android 4.2 NumberPicker https://github.com/SimonVT/android-numberpicker
When kindly omitted the solution in accepted answer, these widget libraries are very usable if you need alter the design, and you like the way iOS does the wheel slider picker.
I am sure,I think my question is something different in android.I goggled 100s of sites i saw the date picker in android, all are same type, no one give the different date picker.
My Task is to design custom date picker. Please find this below screen shot.
https://docs.google.com/file/d/0B_c-SDSO63obZzVreHpmdnZBYzg/edit?usp=sharing
For that I goggled, I didn't find any solution. I think, For android solutions this is the best site.
coming to my date picker it is totally dialog box. In that red symbol,name,close mark,submit i can do it. But i want that sun,man,tue,web In red color and on the top month and year. In below dates with green color picker. so Please tell me how can I do that task.
All advices are accepted.
Thanks&Regards
Shankar
Clite
I can only suggest how I would have gone for such a calendar. By the UI it is clear that it has to come as a pop-up or to better say a dialog. Now you have to google the opensource calendars if any or just using the calendar API provided by java you can get the calendar for a month year etc. and move it across previous month by normal java function calls.
Now that you have got the data to populate in your calendar. You have to design a custom layout xml create ~30-40 boxes or a grid with dynamic textviews or a webview with <table>, <tr>, <td> the choice is completely yours.
AFAIK
If you can't find anything opensource then I would suggest you should do these things by the suggested approach.