如何更改数字对话框android的字体大小

时间:2015-03-15 16:16:22

标签: android dialog

我的数字对话框的标题,我只是一个普通的对话框太长了,我想知道如何让它的字体变小。因为我没有选择使用文本视图。

public void numberPickerDialog() {

    final Dialog d = new Dialog(this);
    d.setTitle("How many times would you like to decrypt?");
    d.setContentView(R.layout.numberpicker1);
    Button btn1 = (Button) d.findViewById(R.id.button1);
    Button btn2 = (Button) d.findViewById(R.id.button2);
    final NumberPicker numPicker = (NumberPicker) d
            .findViewById(R.id.numberPicker1);
    numPicker.setMaxValue(100); // max value 100
    numPicker.setMinValue(1); // min value 0
    numPicker.setWrapSelectorWheel(false);
    numPicker
            .setOnValueChangedListener(new NumberPicker.OnValueChangeListener() {

                @Override
                public void onValueChange(NumberPicker picker, int oldVal,
                        int newVal) {
                    // TODO Auto-generated method stub

                }
            });
    btn1.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            numOfDecrypt = numPicker.getValue(); // set the value to
                                                    // textview
            Log.w("MyApp", "" + numOfDecrypt);
            d.dismiss();
            messageDialog();
        }
    });
    btn2.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            d.dismiss(); // dismiss the dialog
        }
    });
    d.show();

}

1 个答案:

答案 0 :(得分:0)

用它来改变大小

((TextView)alertDialog.findViewById(android.R.id.title)).setTextSize(12);