地址 日期选择器

时间:2018-08-26 12:55:38
【文件属性】:

文件名称:地址 日期选择器

文件大小:2.06MB

文件格式:RAR

更新时间:2018-08-26 12:55:38

地址 日期 选择器

package com.demo.dtselector; import com.custom.dtselector.dialog.DateSelectorDialog; import com.custom.dtselector.dialog.DateSelectorDialog.OnSelectDateEvent; import com.custom.dtselector.dialog.TimeSelectorDialog; import com.custom.dtselector.dialog.TimeSelectorDialog.OnSelectTimeEvent; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView; public class DateTimeSelectorActivity extends Activity { private Activity activity = null; private DateSelectorDialog dateDialog = null; private TimeSelectorDialog timeDialog = null; private TextView txt_date_show = null; private TextView txt_time_show = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.datetime_main); activity = this; Button btnDate = (Button)findViewById(R.id.btn_date_selector); btnDate.setOnClickListener(new OnClickListener(){ @Override public void onClick(View arg0) { // TODO Auto-generated method stub showDateDialog(); } }); Button btnTime = (Button)findViewById(R.id.btn_time_selector); btnTime.setOnClickListener(new OnClickListener(){ @Override public void onClick(View arg0) { // TODO Auto-generated method stub showTimeDialog(); } }); txt_date_show = (TextView)findViewById(R.id.txt_date_show); txt_time_show = (TextView)findViewById(R.id.txt_time_show); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.datetime_selector, menu); return true; } private void showDateDialog() { if (dateDialog == null) { dateDialog = new DateSelectorDialog(); dateDialog.init(activity); dateDialog.setOnSelectDateEvent(new OnSelectDateEvent(){ @Override public void onSelectDateResult(int year, int month, int day) { // TODO Auto-generated method stub txt_date_show.setText(String.format("d-d-d", year,month,day)); } }); } dateDialog.show(); } private void showTimeDialog() { if (timeDialog == null) { timeDialog = new TimeSelectorDialog(); timeDialog.init(activity); timeDialog.setOnSelectTimeEvent(new OnSelectTimeEvent(){ @Override public void onSelectTimeResult(int hour, int minute, int second) { // TODO Auto-generated method stub txt_time_show.setText(String.format("d:d:d", hour,minute,second)); } }); } else { timeDialog.update(null); } timeDialog.show(); } }


【文件预览】:
选择器
----DateTimeSelector.rar(992KB)
----地址选择器Demo.rar(1.09MB)

网友评论

  • 虽然不是我想要的效果 学习了