首页 > 代码库 > android标题栏(titlebar)显示进度条

android标题栏(titlebar)显示进度条

在后台线程中执行各种操作(网络连接、大数据存储)的时候,我们希望让客户能看到后台有操作在进行,那么既能有效的提示用户,又不占用当前操作空间,最好的方法就是在标题栏有个进度条。

[代码] [Java]代码
 
 
protected void onCreate(Bundle savedInstanceState) {
 
    super.onCreate(savedInstanceState);
 
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);//先给Activity注册界面进度条功能
 
    setContentView(R.layout.main);
 
    setProgressBarIndeterminateVisibility(true);//在需要显示进度条的时候调用这个方法
 
    setProgressBarIndeterminateVisibility(false);//在不需要显示进度条的时候调用这个方法
 
}
<iframe id="google_ads_frame5" vspace="0" height="250" marginHeight="0" src="http://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-3447371224873639&output=html&h=250&slotname=8660799060&adk=1970350646&w=300&lmt=1400527689&flash=0&url=http%3A%2F%2Fwww.cnblogs.com%2Fxiaochao1234%2Fp%2F3736887.html&dt=1400527691537&shv=r20140513&cbv=r20140417&saldr=sb&correlator=1400527691159&frm=20&ga_vid=241618604.1400321121&ga_sid=1400510967&ga_hid=621990517&ga_fc=1&u_tz=480&u_his=594&u_java=1&u_h=768&u_w=1364&u_ah=740&u_aw=1364&u_cd=16&u_nplug=0&u_nmime=0&dff=verdana&dfs=16&adx=0&ady=1726&biw=314&bih=74&eid=317150304&oid=3&rx=0&eae=0&docm=9&vis=0&fu=0&ifi=5&xpc=rsfMH8aU41&p=http%3A//www.cnblogs.com&dtd=34" frameBorder="0" width="300" allowTransparency="true" name="google_ads_frame5" marginWidth="0" scrolling="no" hspace="0"></iframe><iframe id="google_ads_frame6" vspace="0" height="250" marginHeight="0" src="http://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-3447371224873639&output=html&h=250&slotname=8660799060&adk=1970350646&w=300&lmt=1400527689&flash=0&url=http%3A%2F%2Fwww.cnblogs.com%2Fxiaochao1234%2Fp%2F3736887.html&dt=1400527691610&shv=r20140513&cbv=r20140417&saldr=sb&prev_slotnames=8660799060&correlator=1400527691159&frm=20&ga_vid=241618604.1400321121&ga_sid=1400510967&ga_hid=621990517&ga_fc=1&u_tz=480&u_his=594&u_java=1&u_h=768&u_w=1364&u_ah=740&u_aw=1364&u_cd=16&u_nplug=0&u_nmime=0&dff=verdana&dfs=16&adx=306&ady=1986&biw=314&bih=74&eid=317150304&oid=3&rx=0&eae=0&docm=9&vis=0&fu=0&ifi=6&xpc=fCdUL3f2xG&p=http%3A//www.cnblogs.com&dtd=44" frameBorder="0" width="300" allowTransparency="true" name="google_ads_frame6" marginWidth="0" scrolling="no" hspace="0"></iframe>