android - 进度条微调器不旋转

标签 android progress-bar

谁能告诉我为什么进度条轮子不旋转...我试图在从网络服务器下载数据时放置一个进度条到目前为止一切都很好...我可以在下载数据时设置进度条但是问题进度条微调器没有旋转....下面是我的进度条代码:

<Progressbar 
    android:id="@+id/xPBar"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true"
    style="@android:style/Widget.ProgressBar.Inverse"/>

这是下载代码: 在执行此方法时,我正在显示进度条

    public void downloadAlerts() {
    mPBar.setVisibility(ProgressBar.VISIBLE);
    Runnable r = new Runnable() {

        @Override
        public void run() {
            if (checkNetworkStatus(getApplicationContext()) == true) {
                String alert = con.execute(ALERTS_URL
                        );
                AlertsParser parser = new AlertsParser();
                parser.parseJson(alert);
                startActivity(new Intent(getApplicationContext(), Alerts.class));
                onSuccessDownload();
            } else if (checkNetworkStatus(getApplicationContext()) == false) {
                onFailureDownload();
            }

        }
    };
    mHandler.post(r);

}

谢谢...

最佳答案

您可能必须将其放入 AsyncTask 中.如果您尝试将进度条放在您的主 UI 线程中,那么如果您按照说明在后台执行其他操作,它就不会移动 here .

关于android - 进度条微调器不旋转,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6343525/

相关文章:

Android 小部件 + 服务

android - fragment 中自定义布局中的 ZXing 条码扫描器

android - 如何列出来自 EvernoteNoteStoreClient.findNotes() 的笔记?当 notefilter 为空时,我可以列出所有笔记本

Android Studio 设计时数据绑定(bind)回退/默认值

android - 我在布局 Activity 中看不到我添加的图片

android - 如何更改无限进度条的颜色?

wolfram-mathematica - 监控Mathematica中并行计算的进度

linux - 多个进度条

android - 在 android 启动时显示进度条和加载图像

css - 标记 Bootstrap 进度条的未完成部分