android-datepicker

Android DatePickerDialog: Set min and max date for selection

烈酒焚心 提交于 2019-12-17 19:58:36
问题 I know there are quite a lot of question for this but none of the solutions are working for me, so this question. I want to restrict user to select date before today, but am not able to do so. public class DatePickerDialogFragment extends DialogFragment { private OnDateSetListener listener; public void setListener(OnDateSetListener listener) { this.listener = listener; } @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { Calendar calendar = Calendar.getInstance();

How to change textsize in datepicker?

一个人想着一个人 提交于 2019-12-17 19:38:17
问题 The default textsize in datepicker is too big for my app. I've seen a way suggested to change it here, but fishing around for the textviews nested inside the datepicker class seems clunky and error prone. Is there a better/cleaner way to do it? 回答1: The easiest way to change the font size of datepicker/timepicker/numberpicker is customizing the theme. In styles file, set the default font size in the following way. <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <!--

How to change textsize in datepicker?

爷,独闯天下 提交于 2019-12-17 19:36:46
问题 The default textsize in datepicker is too big for my app. I've seen a way suggested to change it here, but fishing around for the textviews nested inside the datepicker class seems clunky and error prone. Is there a better/cleaner way to do it? 回答1: The easiest way to change the font size of datepicker/timepicker/numberpicker is customizing the theme. In styles file, set the default font size in the following way. <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <!--

Setting MinDate on DatePicker moves CalendarView to 1964

一世执手 提交于 2019-12-17 18:14:09
问题 I'm debugging an issue where the CalendarView in a DatePicker moves to October 1964 if there is a non-default minimum date set. This reproduces at least on API17 Nexus7 emulator but there are reports about this issue on other devices where the platform style includes both spinners and calendar view in date picker. Here's a code snippet demonstrating the issue: class DatePickerDialog1964 extends DatePickerDialog { DatePickerDialog1964(Context c) { super(c, null, 2013, 4, 21); @SuppressWarnings

datePicker plugin not working in Phonegap 2.0

不羁的心 提交于 2019-12-17 17:09:32
问题 After upgrading to Phonegap 2.0, the datePicker plugin does not work. The error is: Uncaught TypeError: Cannot read property 'datePicker' of undefined. the error occcurs on the javascript code: window.plugins.datePicker.show({... The DatePicker js file: /** * Phonegap DatePicker Plugin Copyright (c) Greg Allen 2011 MIT Licensed * Reused and ported to Android plugin by Daniel van 't Oever */ if (typeof cordova !== "undefined") { /** * Constructor */ function DatePicker() { this._callback; } /*

Android spinner with date picker, like Google Calendar app

我们两清 提交于 2019-12-17 15:23:54
问题 I'm trying to get a text box that looks like a spinner to activate a date picker dialog. This is done in both the Google Calendar app and the Contacts app (for birthdate) on ICS. Do I need to use a spinner, and if so how do I change it's input view to be a date picker? Or if not, how do I get a text view to have the little triangle that usually indicates a spinner? 回答1: Twaddington's comment on his answer is actually the right approach. What you need is to create a text view and apply the

How to disable certain dates in the Android Date Picker dialog?

試著忘記壹切 提交于 2019-12-17 14:01:20
问题 I am using default Android DatePickerDialog which contains android.widget.DatePicker . Does anybody know how to disable or make certain dates unselectable? I know DatePicker allows to setMinDate() and setMaxDate() but it doesn't allow to disable specific dates in the middle. e.g. on this picture would like to disable date 18, 26, etc: 回答1: That is not a built in behavior - you would have to use a custom date picker. 回答2: I got a method by using custom datepicker. First we need to take the

Android Calendar View for Date Picker

試著忘記壹切 提交于 2019-12-17 10:23:13
问题 I'm writing my first app, and I have a question about DatePicker . My app requires the user to input a date. The most user-friendly way would be to popup a calendar-like widget that displays the current month like a calendar grid - something like this: I want to use that in place of the DatePicker interface - which has Month, Day, and Year fields, each with an up and down button to increment/decrement. Is this type of functionality built into any Android widget or view, or would I have to

Android DatePicker shows unavailable months when using min/max limits

霸气de小男生 提交于 2019-12-13 12:25:02
问题 I've only found 1 other instance of this issue on StackOverflow which was unanswered (last year), so I figured I'd give it another shot. (Android DatePicker/Dialog displaying incorrect month/s using min/max date, with an actual image) When setting the minDate and maxDate of the Android DatePicker, it'll show months that are unavailable within the range of min and max date. I'll demonstrate this issue with the following images: When I'm at the minDate: When I'm in between the date limits: When

parse a date from string gives exception in android

浪尽此生 提交于 2019-12-13 09:43:02
问题 I want to parse a string from string to date ,Date is of format like Tuesday March 19,2015 . I want to parse and format it as yyyy-dd-mm format. The below code gives me exception that "unparceble date". Code : DateFormat df1 = new SimpleDateFormat("yyyy-MM-dd"); try { date1 = df1.parse(currentDate); System.out .println("============my formated date====================" + date1.toString()); Calendar cal = Calendar.getInstance(); cal.setTime(date1); cal.add(Calendar.DATE, 10); // add 10 days