Android Material Design Inline Datepicker问题 [英] Android Material Design Inline Datepicker issue

查看:220
本文介绍了Android Material Design Inline Datepicker问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 ScrollView 带有Datepicker



在以前的Android版本中,Datepicker是这样的: / p>



我可以滚动Datepicker的日期,月份,年份的单个元素无需问题



在Android Lollipop API级别21材质中,Datepiker以这种方式显示:





如果我点击月份显示了一个日历视图,我不能更改月份,我只能选择一天。如果我尝试编辑年份显示一年滚动,但如果我尝试滚动它,包含datepicker的整个布局被滚动,不仅是日期。

  calendarViewShown = false 

似乎被忽略



我如何解决这个问题?

解决方案

日历风格的日期选择器中不推荐使用 calendarViewShown 属性。如果您希望回滚样式的日期选择器,可以将 datePickerMode 属性设置为 spinner

 < DatePicker 
...
android:datePickerMode =spinner/>

对于滚动问题,日历风格的日期选择器不支持嵌套滚动。 p>

I have a ScrollView with a Datepicker

In the previous versions of Android the Datepicker is this:

And I can scroll the single elements of Datepicker day, month, years without problems

In Android Lollipop API level 21 Material, the Datepiker is shown in this way:

If I click on the month is shown a calendar view and I cannot change the month, I can only select the day. If I try to edit the year is shown a year scroller, but If I try tro scroll it, the whole layout where datepicker is contained is scrolled, not only the date.

calendarViewShown=false

seems ignored

How could I fix this issue???

解决方案

The calendarViewShown attribute is deprecated in the calendar-style date picker. If you want the spinner-style date picker back, you can set the datePickerMode attribute to spinner.

<DatePicker
    ...
    android:datePickerMode="spinner" />

As for the scrolling issue, the calendar-style date picker doesn't support nested scrolling.

这篇关于Android Material Design Inline Datepicker问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆