private void showDatePicker(){
final Calendar c = Calendar.getInstance();
c.set(Calendar.SECOND, 0);
int year = c.get(Calendar.YEAR);
int month = c.get(Calendar.MONTH);
int day = c.get(Calendar.DAY_OF_MONTH);
final DatePickerDialog dateDialog = new DatePickerDialog(ActForm.this, new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int y, int m, int d) {
//TODO
}
}, year, month, day);
dateDialog.show();
new Handler().post(new Runnable() {
@Override
public void run() {
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
View v = dateDialog.getWindow().getCurrentFocus();
if (null != v && null != v.getWindowToken()) {
imm.hideSoftInputFromWindow(v.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
}
}
});
}
Android日期控件显示时屏蔽软键盘自动弹出
最新推荐文章于 2021-06-23 10:27:45 发布