码迷,mamicode.com
首页 > 移动开发 > 详细

android常用UI使用案例:DatePicker和TimerPicker

时间:2015-07-28 14:33:56      阅读:142      评论:0      收藏:0      [点我收藏+]

标签:

 

<?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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!