Android ProgressBar使应用程序运行得更慢

时间:2014-01-16 11:21:19

标签: android android-asynctask progress-bar

我正在使用postexecute显示进度条并且在postExecute中不可见,并且它可以工作,但是使应用程序工作得很慢,原因是有什么简单的方法可以让它正常工作(不是很慢) ? 这是我的代码:

bar = (ProgressBar) this.findViewById(R.id.progressBar);     
getInfo extends AsyncTask<void, void, void>{   
    protected void onPreExecute() {   
        bar.setVisibility(View.VISIBLE);
    }   
    protected void doInBackground(String... params)                                                  
                  do smth}  
    protected void onPostExecute(Boolean results) {
              bar.setVisibility(View.GONE);
    }
}

1 个答案:

答案 0 :(得分:1)

您是否正在使用自定义进度条,并且是否在应用程序的初始屏幕上显示进度条?

如果您使用的是自定义进度条,则可能需要一些时间才能在应用初始启动期间加载。我有一个类似的问题,问题是由于android:type =&#34; sweep&#34;在自定义进度栏中。 EG:低于

    <shape>
        <gradient
            android:startColor="#000001"
            android:centerColor="#ffffff"
            android:centerY="0.5"
            android:type="sweep"/>
    </shape>

不确定为什么type =&#34; sweep&#34;可能导致问题,但在删除后,应用程序似乎启动很快

相关问题