【问题标题】:How to set progress bar in android?如何在android中设置进度条?
【发布时间】:2011-06-04 23:16:18
【问题描述】:

我想设置进度条直到下一个活动开始。这意味着我想在加载下一页或活动时删除黑屏。如何解决这个问题?

是的,我正在使用按钮 onClick 并使用 listView 来移动下一个活动。

【问题讨论】:

  • 点击按钮后您将移至下一个活动?

标签: android


【解决方案1】:
Button b1 = new Button(this);
b1.setOnTouchListener(new OnTouchListener() 
            {
                public boolean onTouch(View v, MotionEvent event) 
                {
                    int action = event.getAction();
                     if(action==0)
                     {
                     }
                     else  if(action == 1)
                     {   
                        final ProgressDialog dialog = ProgressDialog.show(myFirstActivity.this,"Please wait","Loading...",true);
                         new Thread() 
                         {
                               public void run() 
                               {
                                    try 
                                    {
                                        Thread.sleep(2000);
                                    } catch (InterruptedException e) 
                                    {
                                        e.toString();
                                        e.printStackTrace();
                                    }
                                    finally
                                    {
                                        dialog.dismiss();           
                                    }
                               }
                         }.start();
                      } 
                    return false;
                }
            });



     b1.setOnClickListener(new OnClickListener()
                {
                    public void onClick(View v) 
                    {
                             Intent i1 = new Intent(myFirstActiviyt.this,Second.class);
                             startActivity(i1);
                             }
                             });

试试这个

【讨论】:

【解决方案2】:
【解决方案3】:
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-11-10
  • 1970-01-01
  • 2019-04-03
  • 1970-01-01
  • 1970-01-01
  • 2012-03-20
  • 1970-01-01
相关资源
最近更新 更多