To change the DialogFragment's size, I did the following withing the OnCreateView method
Note: Code in C# for MonoDroid; eaisly translated to Java for raw Android
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
base.OnCreateView(inflater, container, savedInstanceState);
View thisView = inflater.Inflate(Resource.Layout.NewContactDialog, container, false);
thisView.Post(() =>
{
ViewGroup.LayoutParams lp = thisView.LayoutParameters;
lp.Width = 500;
thisView.LayoutParameters = lp;
thisView.Invalidate();
}
);
return thisView;
}
This code is from experimentation. What I settled on was just using a centered DialogFragment (the default behavior) and undimming the background. You can override the style for the DF, and either base it on the existing theme
<style name="MyDialogFragment" parent="android:Theme.Holo.Dialog">
<item name="android:windowIsFloating">true</item>
</style>
Or completely style it from the ground up
<style name="MyDialogFragment">
... (set all items, check docs)
</style>
For starts try using the MyDialogFragment style above and set windowIsFloating to false
and see the effects (just set your theme to this with the SetStyle member).
Some good links for styles and themes you'll need to do your own styling and overriding the defaults:
http://www.therealjoshua.com/2012/01/styling-android-with-defaults/
http://developer.android.com/guide/topics/ui/themes.html/
https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/res/res/values/styles.xml/
https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/res/res/values/themes.xml/
I'll be honest, working with DialogFragments and PopupWindows is a pain, but they are specialized views that solve some real GUI issues, so don't give up. If you need any more info, just ask in the comments below (I realize this is not an answer, I'm just trying to help, b/c I'm working on this stuff right now).