iOS Date Time Picker For Android
Have you every stuck in a situation where you want to ask a user for both date and time at the same time? Android doesn't provide a native library for this scenario.
I will help you to bypass this situation easily! You can simply use the below library to solve this issue.
Including in your project
build.gradle
dependencies {
implementation 'com.github.abdulrehmank7:iOS-date-time-picker:1.05'}
Add it in your root build.gradle at the end of repositories
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Use IOS-Date-Time-Picker in your project
We can use IOS-Date-Time-Picker
without any customized attributes. Simply register a OnDateTimeSelectedListener and them pass that to DialogDateTimePicker dialog.
Dialog Customizations
If you want to make any customization. You can make them easily using below methods.
dateTimePickerDialog.setTitleTextColor(android.R.color.black)
dateTimePickerDialog.setDividerBgColor(android.R.color.black)
dateTimePickerDialog.setCancelBtnColor(R.color.colorAccent)
dateTimePickerDialog.setCancelBtnTextColor(R.color.colorPrimaryDark)
dateTimePickerDialog.setSubmitBtnColor(R.color.colorAccent)
dateTimePickerDialog.setSubmitBtnTextColor(R.color.colorPrimaryDark)
dateTimePickerDialog.setCancelBtnText("Dismiss")
dateTimePickerDialog.setSubmitBtnText("OK")
dateTimePickerDialog.setFontSize(14)
dateTimePickerDialog.setCenterDividerHeight(38)
//Call dateTimePickerDialog.show() after all the customization is set on dialog.
//So dateTimePickerDialog.show() will be called last.
Link to the library GitHub Repository : https://github.com/abdulrehmank7/iOS-date-time-picker
Thank you and I hope this article helped you in some way. If you like the post please support the article by sharing it. Have a nice day!
I am a freelancer who can help you make your idea up and running ✅ . My expertise is in flutter and Android development with 5 years of experience in the industry. You can contact me at my email(abdulrehman0796@gmail.com) for any projects 😊