AlertDialog
출처 : http://blog.naver.com/zzbung?Redirect=Log&logNo=10097674846
Context ctx = getApplicationContext();
LayoutInflater inf1=(LayoutInflater)ctx.getSystemService(LAYOUT_INFLATER_SERVICE);
View layout = inf1.inflate(R.layout.log , null);
AlertDialog.Builder aDlgB = new AlertDialog.Builder(this);
aDlgB.setTitle("Login");
aDlgB.setView(layout);
edtID = (EditText) layout.findViewById(R.id.edtID);
edtPWD = (EditText) layout.findViewById(R.id.edtPWD);
aDlgB.setPositiveButton("확인", new OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
Toast.makeText(LoginMain.this, edtID.getText().toString(), 1000).show();
}
});
aDlgB.setNegativeButton("취소", new OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
finish();
}
});
AlertDialog ad = aDlgB.create();
ad.show();
===log.xml===================================================================
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:text="ID : "
android:layout_width="wrap_content"
android:layout_height="wrap_content"></TextView>
<EditText
android:id="@+id/edtID"
android:layout_width="fill_parent"
android:layout_height="wrap_content"></EditText>
<TextView
android:text="PWD : "
android:layout_width="wrap_content"
android:layout_height="wrap_content"></TextView>
<EditText
android:id="@+id/edtPWD"
android:layout_width="fill_parent"
android:layout_height="wrap_content"></EditText>
</LinearLayout>
'scrap > Android' 카테고리의 다른 글
android dialog (0) | 2011.02.06 |
---|---|
[Android] Activity 에서 Dialog 띄우기. (0) | 2011.02.06 |
ListView, ListAdapter (0) | 2011.02.04 |
android - Selector (0) | 2011.02.04 |
Listview drag&drop (0) | 2011.02.04 |