Android DatePicker 组件顺序
我制作了一个自定义 DatePicker
来扩展 android DatePicker
UI 组件。我需要这个来使每个 DatePicker 的视图组件(日、月和年)的可见性选项成为可能。 我通过按索引隐藏 DatePicker
中的视图来实现这一点。
我通过获取像这样的日期格式顺序来获取每个组件的索引 DateFormat.getDateFormatOrder(context)
,这会返回一个像 {m, d, y} 这样的字符数组,这样我就可以获得DatePicker
组件并隐藏它们。
我遇到的问题是,在某些设备上,DatePicker
根据用户所选的区域设置而不是所选的日期格式来定位其组件。
如何获取 DatePicker
的组件顺序?或者我如何确定 DatePicker
将按区域设置或日期格式定位其组件?
请注意,我正在 Android API 级别 2.1++ 上开发它,我不想制作自己的 DatePicker
,这样我就可以保留 android DialogPicker
UI 主题。
谢谢你!
I made a custom DatePicker
that extends the android DatePicker
UI component. I needed this to make possible the visibility option for each DatePicker
's view component(day,month and year).
I made this possible by hiding the views from DatePicker
by its index.
I get the index of each component by getting the date format order like this DateFormat.getDateFormatOrder(context)
, this returns a char array like {m, d, y} so I can get the order of the DatePicker
components and hide them..
The problem I run into is that on some devices the DatePicker
position its components by the selected locale of the user and not by the selected date format.
How can I get the DatePicker
's components order? Or how I can figure out that DatePicker
will position its components by locale or date format?
Note that I am developing this on Android API level 2.1++ and I would prefer not to make my own DatePicker
so I can preserve the android DialogPicker
UI theme.
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不幸的是答案是:我必须开发自己的 DatePicker,现在一切正常
And unfortunately the answer is: I had to develop my own DatePicker and now everything works fine