0

I am trying to use activity as a dialog, and I have done the following, but still it shows as an activity rather than dialog. I wonder what I am missing or doing wrong?

AndroidManifest.xml

<activity
   android:name="AboutView"
   android:theme="@style/Dialog">
</activity>

Themes.xml

<style name="Dialog" parent="@android:style/Theme.Dialog">
   <item name="windowActionBar">false</item>
   <item name="android:windowNoTitle">true</item>
</style>

AboutView.cs

[MvxFragment(typeof(MainViewModel), Resource.Id.MainViewContainer)]
[Activity(Label = "AboutView", Theme = "@style/Dialog")]
[Register("views.AboutView")]
public class AboutView : MvxFragment<AboutViewModel>
{
    public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
    {
        var ignored = base.OnCreateView(inflater, container, savedInstanceState);
        var view = this.BindingInflate(Resource.Layout.AboutView, null);
        return view;
    } 
}
casillas
  • 16,351
  • 19
  • 115
  • 215

2 Answers2

0

You're only specifying that the Activity's theme should inherit from Dialog's theme. The AboutView class still inherits from MVXFragment, which isn't a Dialog.

I'm not too familiar with Xamarin's class structure, but you'll need to ensure that the AboutView class inherits from Xamarin's version of a Dialog.

In Android studio it would be the DialogFragment class. You could start looking there.

redstonedev
  • 119
  • 1
  • 10
0

I think MvxDialogFragment is exactly what you're looking for. Here you have an example how to use it