Android 单击按钮时,在monodroid中显示加载对话框?

Android 单击按钮时,在monodroid中显示加载对话框?,android,xamarin.android,Android,Xamarin.android,我想在单击按钮时显示加载提示,如何才能做到这一点 protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); // Get our button from the l

我想在单击按钮时显示加载提示,如何才能做到这一点

protected override void OnCreate(Bundle bundle)
    {
        base.OnCreate(bundle);

        // Set our view from the "main" layout resource
        SetContentView(Resource.Layout.Main);

        // Get our button from the layout resource,
        // and attach an event to it
        Button button = FindViewById<Button>(Resource.Id.MyButton);
        objListView = FindViewById<ListView>(Resource.Id.listView1);
        button.Click += button_Click;
    }

    void button_Click(object sender, EventArgs e)
    {
     //in this place i get RSS list from web ,this process take a minute 
    }
protectedoverride void OnCreate(捆绑包)
{
base.OnCreate(bundle);
//从“主”布局资源设置视图
SetContentView(Resource.Layout.Main);
//从布局资源中获取我们的按钮,
//并在其上附加一个事件
Button Button=FindViewById(Resource.Id.MyButton);
objListView=FindViewById(Resource.Id.listView1);
按钮。单击+=按钮\u单击;
}
无效按钮\单击(对象发送者,事件参数e)
{
//在这里,我从网络上获取RSS列表,这个过程需要一分钟
}

首先,您需要在中添加一个用于加载进度的变量

private ProgressDialog progress;

protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);

            Button button = FindViewById<Button>(Resource.Id.MyButton);
            objListView = FindViewById<ListView>(Resource.Id.listView1);

            button.Click += (s, e) => {
                Action act = new Action(YOUR METHOD NAME);
                progress = new ProgressDialog(this);
                progress.SetTitle("loading...");
                progress.Show();

                act.BeginInvoke(a => act.EndInvoke(a), null);
            };
        }
progress.Dismiss();