自定义的DatePicker。安卓 [英] Customize DatePicker. Android

查看:187
本文介绍了自定义的DatePicker。安卓的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有自定义一个datepicker的方式吗?这是我的布局 - code。

is there the way to customize a DatePicker? That is my Layout-Code.

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">
    <LinearLayout
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"
        android:gravity="center_horizontal" 
        android:orientation="vertical">
        <DatePicker 
            android:id="@+id/ad_date_picker"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:layout_margin="5dp"/>
        <TimePicker         
            android:id="@+id/ad_time_picker"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" 
            android:layout_margin="5dp"/>
    </LinearLayout>
</ScrollView>

在这种情况下的DatePicker的日期格式为MM-DD-YYYY,我想有它在DD-MM-YYYY,如果它也有可能我想有一个月的短名称,而不是数量。

In that case the date format of the DatePicker is MM-DD-YYYY and I'd like to have it in DD-MM-YYYY, and if it's also possible I'd like to have month's shortname instead of number.

我试图找到,如何做到这一点,但没有成功。

I've tried to find, how to do it, but without success.

感谢您,

穆尔

推荐答案

您不能自定义默认的。

用户界面页:

Android提供了一套全面实施窗口小部件,如按钮,复选框和文本输入字段,因此您可以快速构建你的UI。搭载Android提供的一些小部件都比较复杂,如日期选择器,时钟,和变焦控制。但你不局限于种由Android平台提供的小部件。如果你想要做一些更加个性化,并创建自己的可操作的元素,你可以通过定义自己的视图对象或通过扩展,并结合现有的小部件。

Android provides a set of fully implemented widgets, like buttons, checkboxes, and text-entry fields, so you can quickly build your UI. Some widgets provided by Android are more complex, like a date picker, a clock, and zoom controls. But you're not limited to the kinds of widgets provided by the Android platform. If you'd like to do something more customized and create your own actionable elements, you can, by defining your own View object or by extending and combining existing widgets.

了解更多的构建自定义组件

这篇关于自定义的DatePicker。安卓的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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