0
我有這樣的代碼來創建一個警告對話框更改字體大小試圖找到TextView的
//Create Alert Dialog
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(title);
builder.setItems(items, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {
// Do something with the selection
Toast.makeText(JourneyPlannerActivity.this, "Selected:"+item,Toast.LENGTH_SHORT).show();
}
});
AlertDialog alert = builder.create();
alert.show();
alert.getWindow().getAttributes();
//Set text Size
TextView textView = (TextView) alert.findViewById(android.R.id.message);
textView.setTextSize(16);
當我嘗試並獲得它總是返回null TextView的,任何想法,爲什麼當返回null?我已經研究了在警告對話框中更改文本大小的所有解決方案,它看起來就是這種方式,任何人都可以看到任何明顯的我做錯了什麼?