Another date selector (DatePicker) corresponding to the time selector can be used to set the year, month, and day. This class is defined as follows: java. lang. Object? Android. view. View? Android. view. ViewGroup? Android. widget. FrameLayout? Android. widget. DatePicker
Common Methods:
No. |
Method |
Type |
Description |
1 |
Public int getYear () |
Normal |
Get the set year |
2 |
Public int getMonth () |
Normal |
Get the set month |
3 |
Public int getDayOfMonth () |
Normal |
Get set date |
4 |
Public void setEnabled (boolean enabled) |
Normal |
Set whether the component is available |
5 |
Public void updateDate (int year, int monthOfYear, int dayOfMonth) |
Normal |
Set a specified date |
.................................................................. Beautiful cut line ..................................................................
JAVA file configuration
package com.example.datepicker11;import android.os.Bundle;import android.app.Activity;import android.view.Menu;import android.widget.DatePicker;public class MainActivity extends Activity {private DatePicker date=null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super. setContentView(R.layout.activity_main); this.date=(DatePicker)super.findViewById(R.id.date2); this.date.updateDate(1992, 03, 18); } }
You can change the simulator language to achieve the Chinese effect.
Next prediction: linearlayout linear Layout