如何以编程方式调整datepicker文本的大小

时间:2016-03-14 02:44:53

标签: android datepicker

我正在使用rey5137的datepicker对话框,如何以编程方式大小调整datepicker文本大小,因为在nexus 7中,datepicker大小非常小......这是代码示例

case R.id.dialog_bt_date_light:
                builder = new DatePickerDialog.Builder(){
                    @Override
                    public void onPositiveActionClicked(DialogFragment fragment) {
                        DatePickerDialog dialog = (DatePickerDialog)fragment.getDialog();
                        String date = dialog.getFormattedDate(SimpleDateFormat.getDateInstance());
                        Toast.makeText(mActivity, "Date is " + date, Toast.LENGTH_SHORT).show();
                        super.onPositiveActionClicked(fragment);
                    }

                    @Override
                    public void onNegativeActionClicked(DialogFragment fragment) {
                        Toast.makeText(mActivity, "Cancelled" , Toast.LENGTH_SHORT).show();
                        super.onNegativeActionClicked(fragment);
                    }
                };

                builder.positiveAction("OK")
                        .negativeAction("CANCEL");
                break;

任何帮助?

1 个答案:

答案 0 :(得分:1)

 <style name="CustomStyle_DatePicker" parent="Material.App.Dialog.DatePicker">
        <item name="dp_dayTextSize">15sp</item>
   </style>

将此样式应用于datepickerdialog

 builder = new DatePickerDialog.Builder(R.style.CustomStyle_DatePicker) {....