当前位置: 首页>>代码示例>>Java>>正文


Java DatePickerDialog.setTitle方法代码示例

本文整理汇总了Java中android.app.DatePickerDialog.setTitle方法的典型用法代码示例。如果您正苦于以下问题:Java DatePickerDialog.setTitle方法的具体用法?Java DatePickerDialog.setTitle怎么用?Java DatePickerDialog.setTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.app.DatePickerDialog的用法示例。


在下文中一共展示了DatePickerDialog.setTitle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: showDatePickerDialog

import android.app.DatePickerDialog; //导入方法依赖的package包/类
private void showDatePickerDialog(Calendar calendar) {
    DebugLog.logMethod();
    if (calendar == null) {
        DebugLog.logMessage("Null calendar");
        return;
    }

    DebugLog.logMessage("Calendar time: " + calendar.getTime().toString());
    datePickerDialog = new DatePickerDialog(
            getContext(),
            R.style.PickerTheme,
            CouponFragment.this,
            calendar.get(Calendar.YEAR),
            calendar.get(Calendar.MONTH),
            calendar.get(Calendar.DAY_OF_MONTH)
    );
    datePickerDialog.getDatePicker().setMinDate(calendar.getTimeInMillis());
    datePickerDialog.setTitle(getString(R.string.title_date_picker));
    datePickerDialog.show();
}
 
开发者ID:darsh2,项目名称:CouponsTracker,代码行数:21,代码来源:CouponFragment.java

示例2: onCreateDialog

import android.app.DatePickerDialog; //导入方法依赖的package包/类
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    chooseDate = (TextView) getActivity().findViewById(R.id.choose_date);
    chooseDate2 = (TextView) getActivity().findViewById(R.id.choose_date2);

    String date = chooseDate.getText().toString();
    int year = Integer.parseInt(date.split("-")[0]);
    int month = Integer.parseInt(date.split("-")[1]);
    int day = Integer.parseInt(date.split("-")[2]);

    DatePickerDialog dialog = new DatePickerDialog(getContext(), this, year, month - 1, day);
    dialog.getDatePicker().setMinDate(System.currentTimeMillis() - 1000);
    dialog.getDatePicker().setMaxDate(System.currentTimeMillis() + (long) 29 * 24 * 60 * 60 * 1000);
    dialog.setTitle(null);
    return dialog;
}
 
开发者ID:Akari10032,项目名称:12306_Android,代码行数:17,代码来源:DatePickerFragment.java

示例3: onClick

import android.app.DatePickerDialog; //导入方法依赖的package包/类
@Optional @OnClick(R2.id.custom_date_view_text_main) protected void onClick() {
    final Calendar calendar = new GregorianCalendar();
    DatePickerDialog datePickerDialog =
            new DatePickerDialog(mContext, new DatePickerDialog.OnDateSetListener() {
                @Override public void onDateSet(DatePicker datePicker, int i, int i1, int i2) {
                    txtHintLayout.setVisibility(VISIBLE);
                    calendar.set(i, i1, i2);
                    SimpleDateFormat format1 =
                            new SimpleDateFormat("dd MMM yyyy", Locale.getDefault());
                    dateText.setText(format1.format(calendar.getTime()));
                    if (mListener != null) {
                        mValidity = mListener.getDateValidity(CustomDateView.this, calendar);
                        validityIcon.setImageDrawable(ContextCompat.getDrawable(getContext(),
                                mValidity ? R.drawable.ic_check_green : R.drawable.ic_error));
                    }
                    if (mValidityListener != null) mValidityListener.checkValidity();
                }
            }, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH),
                    calendar.get(Calendar.DAY_OF_MONTH));
    if (mListener != null) {
        if (mListener.setMaxDate(this) != 0) {
            datePickerDialog.getDatePicker().setMaxDate(mListener.setMaxDate(this));
        }
        if (mListener.setMinDate(this) != 0) {
            datePickerDialog.getDatePicker().setMinDate(mListener.setMinDate(this));
        }
    }
    datePickerDialog.setTitle(mTitle);
    datePickerDialog.show();
}
 
开发者ID:riteshakya037,项目名称:CustomFormViews,代码行数:31,代码来源:CustomDateView.java

示例4: onClick

import android.app.DatePickerDialog; //导入方法依赖的package包/类
@Optional @OnClick(R.id.custom_date_view_text_main) void onClick() {
    final Calendar calendar = new GregorianCalendar();
    DatePickerDialog datePickerDialog =
            new DatePickerDialog(mContext, (datePicker, i, i1, i2) -> {
                calendar.set(i, i1, i2);
                SimpleDateFormat format1 =
                        new SimpleDateFormat(DATE_FORMAT, Locale.getDefault());
                dateText.setText(format1.format(calendar.getTime()));
            }, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH),
                    calendar.get(Calendar.DAY_OF_MONTH));
    datePickerDialog.setTitle("Select Date");
    datePickerDialog.show();
}
 
开发者ID:riteshakya037,项目名称:Subs,代码行数:14,代码来源:CustomDateView.java


注:本文中的android.app.DatePickerDialog.setTitle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。