반응형

출처: http://egloos.zum.com/surprisen/v/2415659

 

<다이얼로그가 뜨는 소스>

Context mContext = getApplicationContext();
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(mtsGetLatLng.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 파일의 소스>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_root" android:orientation="vertical"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:padding="10dp">
<TextView android:text="ID" android:id="@+id/TextView01"
android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
<EditText android:id="@+id/image" android:layout_width="200dip"
android:layout_height="35dip" android:layout_marginRight="10dp" />
<TextView android:text="Password" android:id="@+id/TextView02"
android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
<EditText android:id="@+id/text" android:layout_width="200dip"
android:layout_height="35dip" android:textColor="#FFF" />
</LinearLayout>
반응형

+ Recent posts