I've got an HTML5 INPUT (type="datetime-local") in a WebView, but when I select it, it shows a date-time field that looks like this:
But the same identical element in Chrome looks like this:
This is under Android 7.1, with Chrome v55 installed, so Chrome is being used the WebView component. So, both should show the same thing, right?
I need the latter picker to show up in the WebView, it is much more user friendly (to scroll you can just flick up and down rather than having to repeatedly press the plus or minute buttons.
How do I accomplish this?
Update: I have tried creating this natively using a DatePickerDialog and it does the same thing! I'm targeting minSdkVersion=22, targetSdkVersion=25 (although I have also tried minSdkVersion=25). How do I force Android to display the correct picker for my app?
Update 2: I downloaded a sample app using the native DatePickerDialog and it displays the dialog ok. I don't like the idea of having to try to find the difference between the two projects which is causing the behavioral difference as it could be anything and take an excessive amount of time to find.
Update 3: Using the answer provided by Oleg, I was able to reproduce the second picker using android:Theme.Holo.Light.DarkActionBar. But if I use android:Theme.DeviceDefault.Light I can get a calendar view for input type="date". But the corresponding time picker in the Default theme (the round clock) does not show up for input type="time" and ``input type="datetime-local"` doesn't use the calendar view either.
As discussed in comments, you are likely missing the proper theme. Given that you have access to working app, please apply the same theme, it should solve it
Related
I'm using TimePicker and on newer devices, there is an option to set values from the keyboard:
The problem is that, input accepts values way above 24h. User can put there any 2 digits number (e.g. 82) and still can click "OK".
Because of obvious reasons, it is not acceptable behavior. Is there any way to restrict what values are accepted or at least block the possibility to use the keyboard to input hours/minutes?
Ps. I'm using Afollestad's material dialogs, but as far as I know, he is using default TimePicker below, the only differences are styles and few extensions. I tried without this library, just by using TimePickerDialog and it's exactly the same. If a user sets input higher than 23/59 it's just set to 23/59 accordingly.
Edit: My bad, now I can see that, dialog from this library is not validating the input. With the default implementation, click validates input.
The problem was with the library I've used. I made a PR that fixes this issue. Hopefully, it will be merged in the close future.
I'am trying to create a DateTimePicker for react-native android,the ios side has it in one view but for android its separate. Calling it is not a task but i like to include it both in one view like in ios (my concept in below screenshot).
Not completely like the above some how customize it reduce both its size, is there an option to place them at specific portions of screen.
I repeat the case is react-native(react-js) not android(java)
It is not possible to customize the android picker and reduce their sizes
you suggested.
Instead I would use this library: react-native-date-picker. With that picker you are able to select time and date in the same picker, even in Android. I had exactly the same problem myself and couldn't find any solution to it, so I ended up creating that picker.
https://developer.mozilla.org/fy-NL/demos/detail/html5-calendar/launch
based on the codes above it uses the browser's back/forward buttons to change day.
which of the codes make it do that? I can't figure out why.
and any advice how can I make the event that can't be edited out?
planning it to launch on a mobile application using phonegap
You should have a look at https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Manipulating_the_browser_history. There you have a great starting point to become familiar with the history object.
If you have a look at the calendar.js from the above example they are using the History API very often.
I've got a HTML5 hybrid app that I want to wrap in trigger.io for deployment. On iOS, I've been able to use
<input type="datetime-local" ... />
To get an actual string for the date and time that I want, and to give my users the native date time picker. Doing this in Android, however, just renders the field as a text box with the ISO formatted time in it.
If I use
<input type="datetime" ... />
I'm given the native date picker, followed by the time picker (I can live with that) but when "OK" is pressed, the value of the text box is what the time would be in GMT. I don't want to see GMT, I want (basically) a string of the date and time that was entered.
I've had a look in the all.js file for trigger.io, which has a line like this:
var q=function(t){if(t.getAttribute("data-forge-fixed")!="yes"&&(t.type=="date"||t.type=="datetime"||t.type=="time")){
Note, it's missing the "datetime-local", like so:
var q=function(t){if(t.getAttribute("data-forge-fixed")!="yes"&&(t.type=="date"||t.type=="datetime-local"||t.type=="datetime"||t.type=="time")){
If I edit the file, and save this change, then re-compile my app, all of the changes to all.js are overwritten back to the most recently downloaded version of trigger.io.
Does anyone have a way around this, or is this a bug that I have to wait for them to fix before I can do any more?
This is a bug in our code, sorry about that. We'll make sure a fix is deployed by the end of the week.
I wouldn't recommend this in general, but if you want to work around it now you could edit all.js in .template/android/assets/forge/all.js within your app folder, this only gets replaced when a full server side build is run.
Is the control shown in the image below built-in in the Android Framework or it is a custom control. If it is custom control, should it be built using a button with background that pops a calendar dialog on click?
Thanks
These are just normal TextViews with a custom background selector and an OnClickListener that triggers the dialog.
If you want to know how a certain view or layout is built, you can use a tool called hierachyviewer (which I used here too). It shows the view hierachy of running apps on your device and is included in the Android SDK in your ANDROID_SDK/tools directory. The program is a bit unintuitive at first, but certainly a useful thing to know. See the documentation for more information about this.