首先要注意:分清哪个是 标题栏,哪个是状态栏,记住最顶部显示时间的就是状态栏
关于标题栏显示 ProgressBar :
public class TestProgressBarInTitleBarActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); //注意要在setContentView方法之前设置
setContentView(R.layout.main);
// attention here!!!
setProgressBarIndeterminateVisibility(true); // 控制显示与隐藏
}
}
关于状态栏显示 ProgressBar: