DatePicker的使用(三):初始化

package com.example.androidtest;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.app.DatePickerDialog;
import android.app.TimePickerDialog;
import android.app.Dialog;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.TimePicker;
import android.widget.Toast;
import android.util.Log;

import java.text.DateFormat;
import java.util.Calendar;



public class MainActivity extends Activity {
	
	public void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		
		DatePicker dp = (DatePicker)findViewById(R.id.date_picker);
		dp.init(2014, 4, 8, null);
	}	
	
	
	
	
	
}
<?xml version="1.0" encoding="utf-8"?>


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical" android:layout_width="fill_parent"
  android:layout_height="wrap_content">

  <DatePicker 
      android:id="@+id/date_picker"
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" />




</LinearLayout>


你可能感兴趣的:(DatePicker的使用(三):初始化)