I am creating a custom dialog. Its example code is:
final AlertDialog dialog;
protected AlertDialog createDialog(int dialogId) {
AlertDialog.Builder builder;
builder = new AlertDialog.Builder(parent);
AlertDialog fDialog = null;
switch(dialogId) {
case Constants.cusDialogtId:
builder = new AlertDialog.Builder(parent);
builder.setTitle("Title");
LayoutInflater inflater = (LayoutInflater)parent.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.customdialog, null);
builder.setView(view);
fDialog = builder.create();
break;
}
dialog = fDialog;
return dialog;
}
The problem is that when the dialog is shown, it has a gray background of the native dialog whose some top and bottom border is also shown with my custom dialog.
Is there some way to show only my custom dialog view…???
The XML I am using is:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:orientation="vertical"
android:background="@drawable/bgsmall" >
<EditText android:id="@+id/redeemamount"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:layout_marginLeft="20dip"
android:layout_marginRight="20dip"
android:hint="Enter amount"
android:inputType="numberDecimal">
</EditText>
<Button android:id="@+id/submitRedeemAmountButton"
android:layout_width="fill_parent"
android:layout_height="40dip"
android:text="Submit"
android:textColor="#FFFFFF"
android:textStyle="bold"
android:background="@drawable/buttoncorner"
android:layout_marginTop="20dip"
android:layout_marginLeft="20dip"
android:layout_marginRight="20dip"
android:layout_marginBottom="20dip">
</Button>
</LinearLayout>
I don’t think you can remove the borders by using
AlertDialog.Builder.What you can do is create a
CustomDialogclass that extendsDialogand in the constructor of yourCustomDialogyou inflate yourcustomdialog.xml.Also you will need to create a custom
stylefor your dialog, that hides the borders. Here is an example:Also define the transparent color:
And you will create your dialog using :