Reputation: 4639
I have a DialogFragment that shows a small black border (it seems 1 px width) around the dialog. I want my dialog to be flat, with not borders neither gradients. How can I remove that?
I've tried with the following code without success:
public Dialog onCreateDialog(Bundle savedInstanceState) {
...
AlertDialog result = builder.create();
result.setView(rootView, 0, 0, 0, 0);
result.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
return result;
//return builder.create();
}
Upvotes: 0
Views: 915
Reputation: 1611
try this code
public class QuickActionFragment extends DialogFragment {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Dialog m_dialog = new Dialog(QuickActionFragment.this, R.style.Dialog_No_Border);
LayoutInflater m_inflater = LayoutInflater.from(CustomDialogActivity.this);
View v = LayoutInflater.from(mContext).inflate(R.layout.view_quick_action, null, false);
// SET ALL THE VIEWS
m_dialog.setTitle(null);
m_dialog.setContentView(m_view);
m_dialog.show();
return dialog;
}
}
Add the Dialog_No_Border style in your res/value/style.xml file.
<style name="Dialog_No_Border">
<item name="android:windowIsFloating">true</item>
<item name="android:windowBackground">@color/transparent_color</item>
</style>
Clean project then Run
Upvotes: 1