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

DatimePicker无法设置默认值 #355

Open
shijia2118 opened this issue Jun 27, 2024 · 1 comment
Open

DatimePicker无法设置默认值 #355

shijia2118 opened this issue Jun 27, 2024 · 1 comment

Comments

@shijia2118
Copy link

您好!我的项目需要选择的日期格式为:年月日时分秒,所以我选择了DatimePicker对象。不过在拉起日期选择器时,默认选中的日期不是我所设置的或者我上一次选择的日期,而是开始时间。以下是相关的代码:
DatimeEntity defaultEntity = getDateTimeEntity(time);
DatimeEntity beginEntity = getDateTimeEntity("2024-01-01 00:00:00.000");
DatimeEntity endEntity = DatimeEntity.yearOnFuture(1);

    picker.setBodyWidth(500);
    DatimeWheelLayout wheelLayout = picker.getWheelLayout();
    wheelLayout.setDateMode(DateMode.YEAR_MONTH_DAY);
    wheelLayout.setTimeMode(TimeMode.HOUR_24_HAS_SECOND);
    wheelLayout.setDefaultValue(defaultEntity);
    wheelLayout.setRange(beginEntity, endEntity);
    wheelLayout.setIndicatorEnabled(true);
    wheelLayout.setIndicatorColor(getResources().getColor(R.color.button));
    wheelLayout.setIndicatorSize(getResources().getDisplayMetrics().density * 2);
    wheelLayout.setSelectedTextColor(getResources().getColor(R.color.button));
    wheelLayout.setSelectedTextBold(true);

请帮忙看一下,是我的设置有问题吗?谢谢

@XiaoRanLiu3119
Copy link

defaultValue可以直接传入setRange的第三个参数。点进去看看就知道了,setRange时只传俩,把defaultValue置空了

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

2 participants