如何将文本插入datepicker中?
我需要将文本插入本机Android datePicker
。我该怎么做?
这是我的布局代码:
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="700px"
android:layout_height="300px"
android:background="@drawable/time_format_24"
android:gravity="center"
android:orientation="horizontal">
<TableRow>
<!-- define a TimePicker module -->
<DatePicker
android:id="@+id/datePicker"
android:layout_width="420px"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:calendarViewShown="false"
android:datePickerMode="spinner"
android:endYear="2200"
android:spinnersShown="true"
android:startYear="2010"
android:theme="@style/Theme.picker" />
<TimePicker
android:id="@+id/timePicker"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:theme="@style/Theme.picker"
android:timePickerMode="spinner" />
</TableRow>
</TableLayout>
要实现的最终效果是:
I need to insert text into the native Android DatePicker
. How do I do this?
Here is my layout code:
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="700px"
android:layout_height="300px"
android:background="@drawable/time_format_24"
android:gravity="center"
android:orientation="horizontal">
<TableRow>
<!-- define a TimePicker module -->
<DatePicker
android:id="@+id/datePicker"
android:layout_width="420px"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:calendarViewShown="false"
android:datePickerMode="spinner"
android:endYear="2200"
android:spinnersShown="true"
android:startYear="2010"
android:theme="@style/Theme.picker" />
<TimePicker
android:id="@+id/timePicker"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:theme="@style/Theme.picker"
android:timePickerMode="spinner" />
</TableRow>
</TableLayout>
The final effect to be achieved is this:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用自定义日期Piker库使用此库进行此操作,您可以在一个日期进行任何类型的自定义布局。
库链接: https://github.com/kizitonwose/calendonwose/calendarview
注意:
datepicker中的单日期布局
Use the custom date piker library to do this using this library you can do any type of custom layout for a single date.
Library link: https://github.com/kizitonwose/CalendarView
Note: you can not change the custom single date layout in
DatePicker