2010-11-30 21 views

回答

1

在活動的java類:

protected void startProgress() { 
    ProgressBar pbSpinner = (ProgressBar)findViewById(R.id.activity_progress_bar);  
    pbSpinner.setVisibility(View.VISIBLE);  
} 

protected void stopProgress() { 
    ProgressBar pbSpinner = (ProgressBar)findViewById(R.id.activity_progress_bar); 
    pbSpinner.setVisibility(View.INVISIBLE); 
} 

而在佈局xml文件中可以添加進度條:

<ProgressBar android:id="@+id/activity_progress_bar"    
android:layout_width="wrap_content" android:layout_height="wrap_content"    
android:layout_centerHorizontal="true" android:layout_centerVertical="true">    
</ProgressBar> 
相關問題