### Initialize and Show OptionsPickerView Source: https://github.com/bigkoo/android-pickerview/blob/master/README.md Instantiate and display an OptionsPickerView for selecting options. This example demonstrates setting an OnOptionsSelectListener to handle selection events and configuring the picker with data. ```java //条件选择器 OptionsPickerView pvOptions = new OptionsPickerBuilder(MainActivity.this, new OnOptionsSelectListener() { @Override public void onOptionsSelect(int options1, int option2, int options3 ,View v) { //返回的分别是三个级别的选中位置 String tx = options1Items.get(options1).getPickerViewText() + options2Items.get(options1).get(option2) + options3Items.get(options1).get(option2).get(options3).getPickerViewText(); tvOptions.setText(tx); } }).build(); pvOptions.setPicker(options1Items, options2Items, options3Items); pvOptions.show(); ``` -------------------------------- ### Initialize and Show TimePickerView Source: https://github.com/bigkoo/android-pickerview/blob/master/README.md Instantiate and display a TimePickerView. This example shows how to set an OnTimeSelectListener to handle date selection events and build the picker. ```java //时间选择器 TimePickerView pvTime = new TimePickerBuilder(MainActivity.this, new OnTimeSelectListener() { @Override public void onTimeSelect(Date date, View v) { Toast.makeText(MainActivity.this, getTime(date), Toast.LENGTH_SHORT).show(); } }).build(); ``` -------------------------------- ### Customized OptionsPickerView Configuration Source: https://github.com/bigkoo/android-pickerview/wiki/English-Documentation Configure an OptionsPickerView with custom attributes like text sizes, colors, labels, and linkage behavior. This example sets custom labels for province, city, and district, and disables linkage. ```java pvOptions = new OptionsPickerBuilder(this, new OnOptionsSelectListener() { @Override public void onOptionsSelect(int options1, int option2, int options3 ,View v) { ////Callback String tx = options1Items.get(options1).getPickerViewText() + options2Items.get(options1).get(option2) + options3Items.get(options1).get(option2).get(options3).getPickerViewText(); tvOptions.setText(tx); } }) .setSubmitText("sure") .setCancelText("cancel") .setTitleText("title") .setSubCalSize(18) .setTitleSize(20) .setTitleColor(Color.BLACK) .setSubmitColor(Color.BLUE) .setCancelColor(Color.BLUE) .setTitleBgColor(0xFF666666)//Night mode .setBgColor(0xFF444444)//Night mode .setContentTextSize(18) .setLinkage(false) .setLabels("province", "city", "district") .setCyclic(false, false, false) .setSelectOptions(0, 0, 0) //default options .setOutSideCancelable(false)//dismiss, default is true .build(); pvOptions.setPicker(options1Items, options2Items, options3Items); ``` -------------------------------- ### Customized TimePickerView Configuration Source: https://github.com/bigkoo/android-pickerview/wiki/English-Documentation Configure a TimePickerView with custom attributes such as date range, display types, text, and colors. This example sets year, month, and day selection, custom labels, and specific date ranges. ```java Calendar selectedDate = Calendar.getInstance(); Calendar startDate = Calendar.getInstance(); startDate.set(2013,1,1); Calendar endDate = Calendar.getInstance(); endDate.set(2020,1,1); pvTime = new TimePickerBuilder(this, new OnTimeSelectListener() { @Override public void onTimeSelect(Date date,View v) {//Callback tvTime.setText(getTime(date)); } }) .setType(new boolean[]{true, true, true, false, false, false})//Year, month, day, hour, minute, second. .setCancelText("Cancel") .setSubmitText("Sure") .setContentSize(18) .setTitleSize(20) .setTitleText("Title") .setOutSideCancelable(false)// default is true .isCyclic(true)// default is false .setTitleColor(Color.BLACK) .setSubmitColor(Color.BLUE) .setCancelColor(Color.BLUE) .setTitleBgColor(0xFF666666)//Night mode .setBgColor(0xFF333333)//Night mode .setRange(calendar.get(Calendar.YEAR) - 20, calendar.get(Calendar.YEAR) + 20)//default 1900-2100 years .setDate(selectedDate)// default is System time .setRangDate(startDate,endDate) .setLabel("year","month","day","hours","mins","seconds") .build(); ``` -------------------------------- ### Initialize and Show OptionsPicker Source: https://github.com/bigkoo/android-pickerview/blob/master/README-en.md Instantiate and display the OptionsPickerView. The callback provides the selected options from one, two, or three levels. ```java //OptionsPicker pvOptions = new OptionsPickerBuilder(this, new OnOptionsSelectListener() { @Override public void onOptionsSelect(int options1, int option2, int options3 ,View v) {//Callback String tx = options1Items.get(options1).getPickerViewText() + options2Items.get(options1).get(option2) + options3Items.get(options1).get(option2).get(options3).getPickerViewText(); tvOptions.setText(tx); } }).build(); //pvOptions.setPicker(options1Items); pvOptions.setPicker(options1Items, options2Items); //pvOptions.setPicker(options1Items, options2Items, options3Items); pvOptions.show(); ``` -------------------------------- ### Basic OptionsPickerView Initialization Source: https://github.com/bigkoo/android-pickerview/wiki/English-Documentation Initialize and display a basic OptionsPickerView for selecting options. The `OnOptionsSelectListener` callback provides the selected indices. ```java //OptionsPicker pvOptions = new OptionsPickerBuilder(this, new OnOptionsSelectListener() { @Override public void onOptionsSelect(int options1, int option2, int options3 ,View v) { ////Callback String tx = options1Items.get(options1).getPickerViewText() + options2Items.get(options1).get(option2) + options3Items.get(options1).get(option2).get(options3).getPickerViewText(); tvOptions.setText(tx); } }).build(); //pvOptions.setPicker(options1Items); //pvOptions.setPicker(options1Items, options2Items); pvOptions.setPicker(options1Items, options2Items, options3Items); pvOptions.show(); ``` -------------------------------- ### WheelView Java Initialization and Usage Source: https://github.com/bigkoo/android-pickerview/blob/master/README.md Initialize and configure a WheelView in Java code. Set properties like cyclic behavior, provide data using an adapter, and handle item selection events. ```java WheelView wheelView = findViewById(R.id.wheelview); wheelView.setCyclic(false); final List mOptionsItems = new ArrayList<>(); mOptionsItems.add("item0"); mOptionsItems.add("item1"); mOptionsItems.add("item2"); wheelView.setAdapter(new ArrayWheelAdapter(mOptionsItems)); wheelView.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(int index) { Toast.makeText(MainActivity.this, "" + mOptionsItems.get(index), Toast.LENGTH_SHORT).show(); } }); ``` -------------------------------- ### PickerView Builder Configuration Source: https://github.com/bigkoo/android-pickerview/wiki/Methods-and-parameters Methods for configuring the general behavior and appearance of both TimePicker and OptionsPicker using the Builder pattern. ```APIDOC ## Builder Configuration ### Description Methods for configuring the general behavior and appearance of both TimePicker and OptionsPicker using the Builder pattern. ### Methods - **Builder(Context context, OnTimeSelectListener listener)**: Construction method for the builder. - **build()**: Returns the configured PickerView object. - **setTextXOffset(int textXOffset)**: Sets the horizontal offset for the text within the picker items. - **setOutSideCancelable(boolean cancelable)**: Determines if the picker can be dismissed by clicking outside of it. - **setDividerType(WheelView.DividerType dividerType)**: Sets the type of divider for the wheel view. Supports FILL and WRAP. - **isDialog(boolean isDialog)**: Enables or disables dialog mode for the picker. Defaults to false. - **setLayoutRes(int res, CustomListener customListener)**: Allows for a custom layout resource. Requires adding WheelView to the custom layout. - **show()**: Displays the picker. - **show(View v)**: Displays the picker, passing a view parameter to the callback method. - **WheelView.DividerType.CIRCLE**: A new style for the selected item divider. - **isAlphaGradient(boolean isAlphaGradient)**: Controls whether items have a gradient alpha effect. - **setItemVisibleCount(int count)**: Sets the maximum number of items visible in the picker at once. ``` -------------------------------- ### Basic WheelView in XML Layout Source: https://github.com/bigkoo/android-pickerview/wiki/Home This snippet shows how to directly include the WheelView component in your XML layout file. Ensure the correct package name is used. ```xml ``` -------------------------------- ### OptionsPicker Configuration Source: https://github.com/bigkoo/android-pickerview/wiki/Methods-and-parameters Specific methods for configuring the OptionsPicker, including linkage, default options, and data sources. ```APIDOC ## OptionsPicker Configuration ### Description Specific methods for configuring the OptionsPicker, including linkage, default options, and data sources. ### Methods - **setCyclic(boolean cyclic1, boolean cyclic2, boolean cyclic3)**: Enables or disables cyclic scrolling for up to three levels of options. - **setSelectOptions(int option1, int option2, int option3)**: Sets the default selected options for up to three levels. - **setLinkage(boolean linkage)**: Enables or disables linkage between option levels. Defaults to true. - **setTypeface(Typeface font)**: Sets a custom typeface for the options. - **setNPicker(List Items1, List Items2, List Items3)**: Adds data sources for non-linkage options for up to three levels. ``` -------------------------------- ### Custom Time Picker Layout Source: https://github.com/bigkoo/android-pickerview/wiki/English-Documentation Demonstrates how to create a time picker with a custom layout. Ensure that the IDs for options picker or TimePicker and its child widgets are not modified to avoid NullPointerException. Refer to the demo for custom layout details. ```java private void initCustomTimePicker() { // be careful:In the custom layout, the layout of the ID for optionspicker // or TimePicker and its child widget must not be modified, // otherwise will be reported NullPointerException // For more details, Please refer to the two custom layouts in demo Calendar selectedDate = Calendar.getInstance();//System current time Calendar startDate = Calendar.getInstance(); startDate.set(2013,1,23); Calendar endDate = Calendar.getInstance(); endDate.set(2019,2,28); pvCustomTime = new TimePickerBuilder(this, new OnTimeSelectListener() { @Override public void onTimeSelect(Date date, View v) {//call back btn_CustomTime.setText(getTime(date)); } }) .setType(TimePickerView.Type.YEAR_MONTH_DAY) .setDate(selectedDate) .setRangDate(startDate,endDate) .setLayoutRes(R.layout.pickerview_custom_time, new CustomListener() { @Override public void customLayout(View v) { final TextView tvSubmit = (TextView) v.findViewById(R.id.tv_finish); ImageView ivCancel = (ImageView) v.findViewById(R.id.iv_cancel); tvSubmit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { pvCustomTime.returnData(tvSubmit); } }); ivCancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { pvCustomTime.dismiss(); } }); } }) .setDividerColor(Color.BLACK) .build(); } ``` -------------------------------- ### Add Maven Dependency Source: https://github.com/bigkoo/android-pickerview/blob/master/README-en.md Add this dependency to your project's pom.xml file if you are using Maven. ```xml com.contrarywind Android-PickerView 4.1.8 pom ``` -------------------------------- ### Basic TimePickerView Initialization Source: https://github.com/bigkoo/android-pickerview/wiki/English-Documentation Initialize and display a basic TimePickerView. The `OnTimeSelectListener` callback is invoked when a date is selected. ```java //TimePicker pvTime = new TimePickerBuilder(this, new OnTimeSelectListener() { @Override public void onTimeSelect(Date date,View v) {//Callback tvTime.setText(getTime(date)); } }) .build(); pvTime.show(); ``` -------------------------------- ### Size Configuration Source: https://github.com/bigkoo/android-pickerview/wiki/Methods-and-parameters Methods for adjusting the sizes of text elements within the picker, including submit/cancel buttons, title, and content. ```APIDOC ## Size Configuration ### Description Methods for adjusting the sizes of text elements within the picker, including submit/cancel buttons, title, and content. ### Methods - **setSubCalSize(int Size_Submit_Cancel)**: Sets the text size for the submit and cancel buttons. - **setTitleSize(int Size_Title)**: Sets the text size for the title. - **setContentSize(int Size_Content)**: Sets the text size for the picker's content items. - **setLineSpacingMultiplier(float lineSpacingMultiplier)**: Sets the multiplier for the line spacing between items. Limited to 1.2-2.0 times the max text height. ``` -------------------------------- ### Customize Time Picker Configuration Source: https://github.com/bigkoo/android-pickerview/blob/master/README-en.md Configure a TimePickerBuilder with specific date types, text, sizes, colors, and date ranges. Useful for setting up a time selection interface with custom constraints. ```java Calendar selectedDate = Calendar.getInstance(); Calendar startDate = Calendar.getInstance(); startDate.set(2013,0,1); Calendar endDate = Calendar.getInstance(); endDate.set(2020,11,1); pvTime = new TimePickerBuilder(this, new OnTimeSelectListener() { @Override public void onTimeSelect(Date date,View v) {//callback tvTime.setText(getTime(date)); } }) .setType(new boolean[]{false, false, false, true, true, false})// type of date .setCancelText("Cancel") .setSubmitText("Sure") .setContentSize(18) .setTitleSize(20) .setTitleText("Title") .setOutSideCancelable(false)// default is true .isCyclic(true)// default is false .setTitleColor(Color.BLACK) .setSubmitColor(Color.BLUE) .setCancelColor(Color.BLUE) .setTitleBgColor(0xFF666666)//night mode .setBgColor(0xFF333333)//night mode .setRangDate(startDate,endDate) .setLabel("year","month","day","hours","mins","seconds") .build(); ``` -------------------------------- ### Set Non-Linkage Data for PickerView Source: https://github.com/bigkoo/android-pickerview/blob/master/README-en.md Use this snippet to configure and display a PickerView with three independent data columns. Ensure you have initialized the `OptionsPickerView` and provided the data lists (food, clothes, computer). ```java pvNoLinkOptions = new OptionsPickerBuilder(this, new OnOptionsSelectListener() { @Override public void onOptionsSelect(int options1, int options2, int options3, View v) { String str = "food:"+food.get(options1) +"\nclothes:"+clothes.get(options2) +"\ncomputer:"+computer.get(options3); Toast.makeText(MainActivity.this,str,Toast.LENGTH_SHORT).show(); } }).build(); pvNoLinkOptions.setNPicker(food,clothes,computer); pvNoLinkOptions.show(); ``` -------------------------------- ### Text Configuration Source: https://github.com/bigkoo/android-pickerview/wiki/Methods-and-parameters Methods for customizing the text of the submit, cancel, and title elements of the picker. ```APIDOC ## Text Configuration ### Description Methods for customizing the text of the submit, cancel, and title elements of the picker. ### Methods - **setSubmitText(String Str_Submit)**: Sets the text for the submit button. - **setCancelText(String Str_Cancel)**: Sets the text for the cancel button. - **setTitleText(String Str_Title)**: Sets the text for the picker's title. ``` -------------------------------- ### TimePicker Configuration Source: https://github.com/bigkoo/android-pickerview/wiki/Methods-and-parameters Specific methods for configuring the TimePicker, including date, range, labels, and cyclic behavior. ```APIDOC ## TimePicker Configuration ### Description Specific methods for configuring the TimePicker, including date, range, labels, and cyclic behavior. ### Methods - **setType(TimePickerView.Type type)**: Sets the time format type. Supports six modes. - **gravity(int gravity)**: Sets the gravity for the picker. Defaults to center. - **setDate(Date date)**: Sets the initial date for the picker. Defaults to the system date. - **setRange(int startYear, int endYear)**: Sets the selectable year range. - **setLabel(String label_year, String label_month, String label_day, String label_hours, String label_mins, String label_seconds)**: Sets the labels for year, month, day, hours, minutes, and seconds. Can be set to null or "" to hide. - **isCyclic(boolean cyclic)**: Enables or disables cyclic scrolling for the time picker. Defaults to true. ``` -------------------------------- ### Color Configuration Source: https://github.com/bigkoo/android-pickerview/wiki/Methods-and-parameters Methods for customizing the colors of various elements within the picker, including text, background, and dividers. ```APIDOC ## Color Configuration ### Description Methods for customizing the colors of various elements within the picker, including text, background, and dividers. ### Methods - **setSubmitColor(int Color_Submit)**: Sets the text color for the submit button. - **setCancelColor(int Color_Cancel)**: Sets the text color for the cancel button. - **setTitleColor(int Color_Title)**: Sets the text color for the title. - **setBgColor(int Color_Background_Wheel)**: Sets the background color for the wheel view. - **setTitleBgColor(int Color_Background_Title)**: Sets the background color for the title area. - **setDividerColor(int dividerColor)**: Sets the color of the divider lines. - **setTextColorCenter(int textColorCenter)**: Sets the text color for the currently selected item. - **setTextColorOut(int textColorOut)**: Sets the text color for items that are not currently selected. ``` -------------------------------- ### Customize Options Picker Configuration Source: https://github.com/bigkoo/android-pickerview/blob/master/README-en.md Configure an OptionsPickerBuilder for multi-level selection with custom text, sizes, colors, and linkage options. Suitable for selecting hierarchical data like regions or categories. ```java pvOptions = new OptionsPickerBuilder(this, new OnOptionsSelectListener() { @Override public void onOptionsSelect(int options1, int option2, int options3 ,View v) { ////Callback String tx = options1Items.get(options1).getPickerViewText() + options2Items.get(options1).get(option2) + options3Items.get(options1).get(option2).get(options3).getPickerViewText(); tvOptions.setText(tx); } }) .setSubmitText("sure") .setCancelText("cancel") .setTitleText("title") .setSubCalSize(18) .setTitleSize(20) .setTitleColor(Color.BLACK) .setSubmitColor(Color.BLUE) .setCancelColor(Color.BLUE) .setTitleBgColor(0xFF666666)//night mode .setBgColor(0xFF444444)//night mode .setContentTextSize(18) .setLinkage(false) .isCenterLabel(false) //default is true , if you choose false , the label text will add to all item ContentText right .setLabels("province", "city", "district") .setCyclic(false, false, false) .setSelectOptions(0, 0, 0) //default options .setOutSideCancelable(false)//dismiss, default is true .isRestoreItem(true)// restore option with first item when select changed。 .build(); pvOptions.setPicker(options1Items, options2Items, options3Items); ``` -------------------------------- ### Custom Layout for OptionsPicker Source: https://github.com/bigkoo/android-pickerview/blob/master/README.md Implement a custom layout for OptionsPicker by providing a layout resource ID and a custom listener for view initialization and event handling. Ensure required IDs like 'optionspicker' or 'timepicker' are present in the custom layout. ```java // 注意:自定义布局中,id为 optionspicker 或者 timepicker 的布局以及其子控件必须要有,否则会报空指针 // 具体可参考demo 里面的两个自定义布局 pvCustomOptions = new OptionsPickerBuilder(this, new OptionsPickerView.OnOptionsSelectListener() { @Override public void onOptionsSelect(int options1, int option2, int options3, View v) { //返回的分别是三个级别的选中位置 String tx = cardItem.get(options1).getPickerViewText(); btn_CustomOptions.setText(tx); } }) .setLayoutRes(R.layout.pickerview_custom_options, new CustomListener() { @Override public void customLayout(View v) { //自定义布局中的控件初始化及事件处理 final TextView tvSubmit = (TextView) v.findViewById(R.id.tv_finish); final TextView tvAdd = (TextView) v.findViewById(R.id.tv_add); ImageView ivCancel = (ImageView) v.findViewById(R.id.iv_cancel); tvSubmit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { pvCustomOptions.returnData(tvSubmit); } }); ivCancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { pvCustomOptions.dismiss(); } }); tvAdd.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { getData(); pvCustomOptions.setPicker(cardItem); } }); } }) .build(); pvCustomOptions.setPicker(cardItem);//添加数据 ``` -------------------------------- ### Add Maven Dependency Source: https://github.com/bigkoo/android-pickerview/blob/master/README.md Alternatively, add the Android-PickerView library to your project using Maven by including the provided dependency in your pom.xml file. ```xml com.contrarywind Android-PickerView 4.1.9 pom ``` -------------------------------- ### WheelView XML Layout Source: https://github.com/bigkoo/android-pickerview/blob/master/README.md Define a WheelView in your XML layout file using the com.contrarywind.view.WheelView tag. This sets up the basic structure for the wheel view. ```xml ``` -------------------------------- ### Add Gradle Dependency Source: https://github.com/bigkoo/android-pickerview/wiki/English-Documentation Include the PickerView library in your Android project by adding this dependency to your build.gradle file. ```java compile 'com.contrarywind:Android-PickerView:4.1.9' ``` -------------------------------- ### Correct Date Setting for Calendar Source: https://github.com/bigkoo/android-pickerview/blob/master/README-en.md When setting dates, be mindful of the Calendar component's internal 1-based month indexing. Use 0-based indexing for months to avoid off-by-one errors. ```java //StartDate.set (2013,0,1); //EndDate.set (2020,11,31); ``` -------------------------------- ### Customize TimePickerBuilder Properties Source: https://github.com/bigkoo/android-pickerview/blob/master/README.md Configure the TimePicker to set date ranges, labels, text sizes, colors, and dialog appearance. Use this for custom date and time selection interfaces. ```java Calendar selectedDate = Calendar.getInstance(); Calendar startDate = Calendar.getInstance(); //startDate.set(2013,1,1); Calendar endDate = Calendar.getInstance(); //endDate.set(2020,1,1); //正确设置方式 原因:注意事项有说明 startDate.set(2013,0,1); endDate.set(2020,11,31); pvTime = new TimePickerBuilder(this, new OnTimeSelectListener() { @Override public void onTimeSelect(Date date,View v) {//选中事件回调 tvTime.setText(getTime(date)); } }) .setType(new boolean[]{true, true, true, true, true, true})// 默认全部显示 .setCancelText("Cancel")//取消按钮文字 .setSubmitText("Sure")//确认按钮文字 .setContentSize(18)//滚轮文字大小 .setTitleSize(20)//标题文字大小 .setTitleText("Title")//标题文字 .setOutSideCancelable(false)//点击屏幕,点在控件外部范围时,是否取消显示 .isCyclic(true)//是否循环滚动 .setTitleColor(Color.BLACK)//标题文字颜色 .setSubmitColor(Color.BLUE)//确定按钮文字颜色 .setCancelColor(Color.BLUE)//取消按钮文字颜色 .setTitleBgColor(0xFF666666)//标题背景颜色 Night mode .setBgColor(0xFF333333)//滚轮背景颜色 Night mode .setDate(selectedDate)// 如果不设置的话,默认是系统时间*/ .setRangDate(startDate,endDate)//起始终止年月日设定 .setLabel("年","月","日","时","分","秒")//默认设置为年月日时分秒 .isCenterLabel(false) //是否只显示中间选中项的label文字,false则每项item全部都带有label。 .isDialog(true)//是否显示为对话框样式 .build(); ``` -------------------------------- ### Add WheelView Library Dependency Source: https://github.com/bigkoo/android-pickerview/blob/master/README.md Include the WheelView library in your project's Gradle dependencies to use its basic wheel view component for custom UI implementations. ```gradle compile 'com.contrarywind:wheelview:4.1.0' ``` -------------------------------- ### Options Picker with No Linkage Source: https://github.com/bigkoo/android-pickerview/wiki/English-Documentation Configures an OptionsPicker where the selections in different columns are independent. This is useful when you need to select items from separate lists without a hierarchical relationship. ```java pvNoLinkOptions = new OptionsPickerBuilder(this, new OnOptionsSelectListener() { @Override public void onOptionsSelect(int options1, int options2, int options3, View v) { String str = "food:"+food.get(options1) +"\nclothes:"+clothes.get(options2) +"\ncomputer:"+computer.get(options3); Toast.makeText(MainActivity.this,str,Toast.LENGTH_SHORT).show(); } }).build(); pvNoLinkOptions.setNPicker(food,clothes,computer); pvNoLinkOptions.show(); ``` -------------------------------- ### Custom Time Picker Layout Source: https://github.com/bigkoo/android-pickerview/blob/master/README-en.md Implement a custom layout for the TimePicker, overriding default UI elements like submit and cancel buttons. This allows for a fully branded or uniquely interactive time selection experience. ```java private void initCustomTimePicker() { // be careful:In the custom layout, the layout of the ID for optionspicker // or TimePicker and its child widget must not be modified, // otherwise will be reported NullPointerException // For more details, Please refer to the two custom layouts in demo Calendar selectedDate = Calendar.getInstance();//System current time Calendar startDate = Calendar.getInstance(); startDate.set(2013,1,23); Calendar endDate = Calendar.getInstance(); endDate.set(2019,2,28); pvCustomTime = new TimePickerBuilder(this, new OnTimeSelectListener() { @Override public void onTimeSelect(Date date, View v) {//call back btn_CustomTime.setText(getTime(date)); } }) .setType(new boolean[]{true, true, true, false, false, false})// year - month - day .setDate(selectedDate) .setRangDate(startDate,endDate) .setLayoutRes(R.layout.pickerview_custom_time, new CustomListener() { @Override public void customLayout(View v) { final TextView tvSubmit = (TextView) v.findViewById(R.id.tv_finish); ImageView ivCancel = (ImageView) v.findViewById(R.id.iv_cancel); tvSubmit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { pvCustomTime.returnData(tvSubmit); } }); ivCancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { pvCustomTime.dismiss(); } }); } }) .setDividerColor(Color.BLACK) .build(); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.