Custom Dialog In Android
I want to custom dialog to change only body of the alert. I want to output like in this screen shot: But I have no idea on such a type of dialog. Any help is greatly appreciated.
Solution 1:
Please check below link
http://www.helloandroid.com/tutorials/how-display-custom-dialog-your-android-application
http://www.thiyagaraaj.com/articles/android-articles/customdialogboxpopupusinglayoutinandroid
http://www.thecompboy.com/2011/11/android-tutorial-custom-dialog.html
http://www.mysamplecode.com/2011/06/android-custom-dialog-box-sample-code.html
Solution 2:
Yes you can change your Dialog box as you want.You can do this by creating a custom dialog box. Step1.Create a style in String file in res
<stylename="myQuitDialog"parent="android:Theme.Dialog"><itemname="android:gravity">center_horizontal</item></style>
Step2. Create the xml file in layouts
<?xml version="1.0" encoding="utf-8"?><RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:id="@+id/layout_quit"android:orientation="horizontal"android:layout_width="wrap_content"android:layout_height="wrap_content"android:background="@drawable/image which u want to show"
>
Step3. Write code of custom dialog box in src
classCustom_DialogextendsDialog {
protectedCustom_Dialog(Context context, int theme) {
super(context, theme);
// TODO Auto-generated constructor stub
}
}
privatevoidshow_alert() {
finalCustom_Dialogalertbox=newCustom_Dialog(this, R.style.myQuitDialog);
Windowwindow= alertbox.getWindow();
window.setBackgroundDrawableResource(android.R.color.transparent);
window.requestFeature(window.FEATURE_NO_TITLE);
alertbox.show();
alertbox.setCancelable(true);
alertbox.setCanceledOnTouchOutside(true);
alertbox.dismiss();
}
}
Solution 3:
you can make your own activity and set android:theme="@android:style/Theme.Dialog"
property for it in AndroidManifest.xml so it'll looks like dialog-window
Post a Comment for "Custom Dialog In Android"