Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
638 views
in Technique[技术] by (71.8m points)

layout - Customize DatePicker. Android

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>

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.

Thank you,

Mur

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can't customize the default one.

From User Interface page:

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.

Read more in Building Custom Components.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...