AlertDialog.Builder aDialog = new AlertDialog.Builder(testapp.this); aDialog.setTitle(“newnhons”); aDialog.setView(layout);
aDialog.setPositiveButton(“ok”, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }); aDialog.setNegativeButton(“cancle”, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }); AlertDialog ad = aDialog.create(); ad.show();
Context mContext = getApplicationContext();
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.dialog,(ViewGroup) findViewById(R.id.layout_root));
AlertDialog.Builder aDialog = new AlertDialog.Builder(testapp.this);
aDialog.setTitle(“newnhons”);
aDialog.setView(layout);
aDialog.setPositiveButton(“ok”, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
}
});
aDialog.setNegativeButton(“cancle”, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
}
});
AlertDialog ad = aDialog.create();
ad.show();
ถามเองตอบเอง
0.0
สงสัยจะอยากรู้จริงๆเลเะมั้งนั่น ^^ เข้ามาเเซวอิอิ
พี่นิว เหมือนผมเคยทำได้ว่ะ พี่ แต่ ลบออกไปแล้วอะ หรือพี่ต้องการเขียนรูปแบบเฉยๆ เด่วผมช่วยหา
ทำหน้า XML UI ขึ้นมาแล้วสั่งให้ AlertDialog.Builder ไปเรียกมาใช้ได้ครับ จัดได้ตามใจทุกอย่างที่อยู่ ใน XML layout เลยละ