直播平台源码,Android中常用Dialog弹窗效果
1、ProgressDialog
private void showProgressDialog(){
progressDialog = new ProgressDialog(DialogDemo.this);
//设置提示信息
progressDialog.setTitle("提示");
progressDialog.setIcon(R.mipmap.touxiang0);
progressDialog.setMessage("正在处理中");
//是否用过返回键取消
progressDialog.setCancelable(true);
//碰触弹框之外的地方取消
progressDialog.setCanceledOnTouchOutside(true);
//显示
progressDialog.show();
}
2、DatePickerDialog
//日期
private void datePickerDialog(){
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N){
DatePickerDialog datePickerDialog = new DatePickerDialog(DialogDemo.this);
datePickerDialog.setOnDateSetListener(new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
Toast.makeText(DialogDemo.this,year+"年"+(month+1)+"月"+dayOfMonth+"日",Toast.LENGTH_SHORT).show();
}
});
datePickerDialog.show();
}else {
Toast.makeText(DialogDemo.this,"版本过低",Toast.LENGTH_SHORT).show();
}
}
3、TimePickerDialog
//时间
private void timePickerDialog(){
//获得日历的实列
Calendar calendar = Calendar.getInstance();
//设置当前时间
calendar.setTimeInMillis(System.currentTimeMillis());
//获取时分
int hour = calendar.get(Calendar.HOUR_OF_DAY);
int minute = calendar.get(Calendar.MINUTE);
//第三、四个参数初始时分 第五个参数是否为24小时显示
TimePickerDialog time = new TimePickerDialog(DialogDemo.this, new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
Toast.makeText(DialogDemo.this,"Hour"+hourOfDay+"minute"+minute,Toast.LENGTH_SHORT).show();
}
},hour,minute,true);
time.show();
}
以上就是直播平台源码,Android中常用Dialog弹窗效果, 更多内容欢迎关注之后的文章