Android自定义dialog可选择展示年月日时间选择栏-创新互联

自定义dialog

站在用户的角度思考问题,与客户深入沟通,找到红寺堡网站设计与红寺堡网站推广的解决方案,凭借多年的经验,让设计与互联网技术结合,创造个性化、用户体验好的作品,建站类型包括:成都网站建设、做网站、企业官网、英文网站、手机端网站、网站推广、域名与空间、网页空间、企业邮箱。业务覆盖红寺堡地区。
package com.poptest; 
import android.app.DatePickerDialog; 
import android.content.Context; 
import android.view.View; 
import android.view.ViewGroup; 
import android.widget.DatePicker; 
//dialog类  
public class YearPickerDialog extends DatePickerDialog { 
  public YearPickerDialog(Context context, OnDateSetListener callBack, int year, int monthOfYear, int dayOfMonth) { 
    super(context, callBack, year, monthOfYear, dayOfMonth);  
    this.setTitle(year + "年" + (monthOfYear + 1) + "月"); 
    //getChildAt(2)隐藏日的显示可以改变隐藏的对象 
   ((ViewGroup) ((ViewGroup) this.getDatePicker().getChildAt(0)).getChildAt(0)).getChildAt(2).setVisibility(View.GONE); 
   ((ViewGroup) ((ViewGroup) this.getDatePicker().getChildAt(0)).getChildAt(0)).getChildAt(2).setVisibility(View.GONE); 
  }  
  public YearPickerDialog(Context context, int theme, OnDateSetListener listener, int year, int monthOfYear, int dayOfMonth) { 
    super(context, theme, listener, year, monthOfYear, dayOfMonth); 
 
   this.setTitle(year + "年" + (monthOfYear + 1) + "月"); 
    ((ViewGroup) ((ViewGroup) this.getDatePicker().getChildAt(0)).getChildAt(0)).getChildAt(2).setVisibility(View.GONE); 
    ((ViewGroup) ((ViewGroup) this.getDatePicker().getChildAt(0)).getChildAt(0)).getChildAt(2).setVisibility(View.GONE); 
  }  
  @Override 
 public void onDateChanged(DatePicker view, int year, int month, int day) { 
    super.onDateChanged(view, year, month, day); 
    this.setTitle(year + "年" + (month + 1) + "月"); 
  } 
} 

文章标题:Android自定义dialog可选择展示年月日时间选择栏-创新互联
当前网址:https://www.cdcxhl.com/article44/dpgjhe.html

成都网站建设公司_创新互联,为您提供全网营销推广网站设计公司网站收录网站排名外贸建站定制网站

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

外贸网站制作