标签:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" > <DatePicker android:id="@+id/date_picker" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TimePicker android:id="@+id/time_picker" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout>
package com.test.androidui; import android.app.Activity; import android.os.Bundle; import android.widget.DatePicker; import android.widget.TimePicker; public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); DatePicker dp = (DatePicker) this.findViewById(R.id.date_picker); dp.init(2015, 5, 1, null); TimePicker tp = (TimePicker) this.findViewById(R.id.time_picker); tp.setIs24HourView(true); } }
android常用UI使用案例:DatePicker和TimerPicker
标签:
原文地址:http://www.cnblogs.com/2015android/p/4682662.html