如何更改数字对话框的字体大小 android
How to change font size of number dialog android
我为我的数字对话框制作的标题,这只是一个普通的对话框,太长了,我想知道如何让它的字体变小。因为我没有使用文本视图的选项。
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();
}
使用这个来改变尺寸
((TextView)alertDialog.findViewById(android.R.id.title)).setTextSize(12);
我为我的数字对话框制作的标题,这只是一个普通的对话框,太长了,我想知道如何让它的字体变小。因为我没有使用文本视图的选项。
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();
}
使用这个来改变尺寸
((TextView)alertDialog.findViewById(android.R.id.title)).setTextSize(12);