LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.custom_dialog,(ViewGroup) findViewById(R.id.layout_root));
AlertDialog.Builder aDialog = new AlertDialog.Builder(Main.this);
aDialog.setTitle("로그인");
aDialog.setView(layout);
aDialog.setPositiveButton("로그인", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
}
});
aDialog.setNegativeButton("취소", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
}
});
AlertDialog ad = aDialog.create();
ad.show();
- custom_dialog.xml -
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_root"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:padding="10dp" >
<TextView
android:id="@+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ID" >
</TextView>
<EditText
android:id="@+id/image"
android:layout_width="200dip"
android:layout_height="35dip"
android:layout_marginRight="10dp" />
<TextView
android:id="@+id/TextView02"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Password" >
</TextView>
<EditText
android:id="@+id/text"
android:layout_width="200dip"
android:layout_height="35dip"
android:ems="10"
android:inputType="textPassword" />
</LinearLayout>
'미노스 안드로이드' 카테고리의 다른 글
[안드로이드] 맵뷰에 사용할 구글맵키 얻어오기 (0) | 2012.10.31 |
---|---|
[안드로이드] 리스트뷰 드래그시 검은색 없애기 (0) | 2012.09.27 |
[안드로이드]뷰플리퍼 사용 및 터치이벤트 (0) | 2012.07.25 |
[안드로이드] INSTALL_FAILED_INSUFFICIENT_STORAGE (0) | 2012.07.24 |
[안드로이드]리스트뷰 리스트 클릭했을 때 인텐트 동작 (0) | 2012.07.23 |