I need to create a dialog over a fragment (that takes up the whole screen). The dialog needs to be a floating dialog that will be positioned over the fragment with the fragment darkened out outside of the fragment..
For the custom Dialog, i have a linearLayout that has curved edges, no matter what i do, the dialog has a black bordering on all sides (very small). I've tried everything to make it transparent and go away (so that all of the dialog is just the linear layout - curved box)
For the DialogFragment, this is what I have for onCreateView
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
LinearLayout layout =(LinearLayout)inflater.inflate(R.layout.custom_dialog, null);
LinearLayout item = (LinearLayout)layout.findViewById(R.id.display_item);
populateItemData(item, inflater);
return layout;
}
custom_dialog is just a LinearLayout that has android:backgroung set to #000000
This is my style for the custom Dialog
<style name="CustomDialog" parent="android:style/Theme.Dialog">
<item name="android:windowBackground">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:alwaysDrawnWithCache">false</item>
<item name="android:windowContentOverlay">@null</item>
</style>
I tried all kinds of combinations in this style (from what I've seen online) and I can't get rid of that annoying black bordering, I can paint it white or any other color if i set that LinearLayout background to anything other than #000000...
I've spent literally 3-4 hours on this, i hope someone else can help out...
Try
in your
DialogFragment
'sonCreateView
Try this (How to I create a 100% custom DialogFragment) this work for dialog
Those who are using AlertDialog builder in
onCreateDialog
instead ofonCreateView
can assign theme like following code. Complete set of themes can be found from R.style. Don't forget that some of them supported recently and are not available on old device phones.