Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timepicker: How to show month name instead of number? #660

Open
abiemann opened this issue Oct 3, 2018 · 3 comments
Open

Timepicker: How to show month name instead of number? #660

abiemann opened this issue Oct 3, 2018 · 3 comments

Comments

@abiemann
Copy link

abiemann commented Oct 3, 2018

I am using the TimePicker and I would like to show the month name ("January, February"...) instead of month number (1, 2, ... ). How is it possible ?

@Rohitsachdeva
Copy link

waiting for answer

@Rohitsachdeva
Copy link

Rohitsachdeva commented Dec 3, 2018

    ArrayList<ArrayList<String>> monthItems = new ArrayList<>();
    Calendar calendar = Calendar.getInstance();
    calendar.set(Calendar.YEAR, 2000);
    Log.i("DATE", calendar.getTime().toString());
    ArrayList<String> listHeader = new ArrayList<>();
    listHeader.add("JAN");
    listHeader.add("FEB");
    listHeader.add("MAR");
    listHeader.add("APR");
    listHeader.add("MAY");
    listHeader.add("JUN");
    listHeader.add("JUL");
    listHeader.add("AUG");
    listHeader.add("SEP");
    listHeader.add("OCT");
    listHeader.add("NOV");
    listHeader.add("DEC");


    for (int i = 0; i < 12; i++) {
        calendar.set(Calendar.MONTH, i);
        ArrayList<String> dayList = new ArrayList<>();
        for (int j = 1; j <= calendar.getActualMaximum(Calendar.DAY_OF_MONTH); j++) {
            dayList.add(String.format("%02d", j));
        }
        monthItems.add(dayList);
    }


    pvCustomLunarMonthDay = new OptionsPickerBuilder(getActivity(), 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);
//                pvCustomLunarMonthDay.set
        }
    }).build();
    pvCustomLunarMonthDay.setPicker(listHeader, monthItems);
    pvCustomLunarMonthDay.show();

@ru-alxr
Copy link

ru-alxr commented Feb 17, 2019

@abiemann
@Rohitsachdeva

check out my pull request: #718

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants