我有我的設置功能自定義對話框:動態設置自定義AlertDialog內容
public void customDialog(Bitmap bm, String title){
TextView dialogtext = (TextView)findViewById(R.id.layout_root);
//For above also tried r.id.popup which is the containing file for the layout
ImageView dialogimage = (ImageView)findViewById(R.id.popupimage);
dialogtext.setText(title);
dialogimage.setImageBitmap(bm);
LayoutInflater inflater = getLayoutInflater();
View layout = inflater.inflate(R.layout.popup, (ViewGroup) findViewById(R.id.layout_root));
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setView(layout);
builder.show();
}
對話框沒有每當我試圖用一個空指針異常動態設置XML領域。我難過,有什麼想法?我是否需要爲清單添加一些自定義對話框?
你能張貼的佈局XML文件? – koopaking3 2012-02-18 00:58:19