0

ボタンをクリックしたときに読み込みプロンプトを表示したいのですが、どうすればよいですか?

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 
    }
4

1 に答える 1

0

まず、進行状況をロードするために変数を追加する必要があります

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();
于 2012-11-04T06:04:39.743 に答える