标签: android-progressbar

ActionBarSherlock不确定进度指示器不会在模拟器中消失

我希望我的应用与Android 2.1兼容.在我的手机上(HTC One X,Android 4+)一切正常,但在模拟器(2.1)中,不确定的进度条不会消失.

我请求创建活动的功能并启动加载任务:

@Override
protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstance);
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

    new LoadDataTask().execute();
}
Run Code Online (Sandbox Code Playgroud)

在我的加载任务的执行前和后执行中,进度条显示/隐藏:

private class LoadDataTask extends AsyncTask<Void, Void, Void>
{
    @Override
    protected void onPreExecute()
    {
        setProgressBarIndeterminateVisibility(true);
    }

    @Override
    protected void onPostExecute(Void result)
    {
        setProgressBarIndeterminateVisibility(false);
    }
}
Run Code Online (Sandbox Code Playgroud)

这在我的手机上工作正常,但模拟器只显示进度条,从不隐藏它.

我在这里使用了错误的方法吗?

android android-progressbar actionbarsherlock progress-bar

4
推荐指数
1
解决办法
1842
查看次数

Android ProgressBar没有更新onProgress

进度条不会更新.但是,它在完成任务时结束.

int totalSms = 12;
int currentSms = 0;

public class ProgressTask extends AsyncTask<String, Integer, Boolean> {

    /** progress dialog to show user that the backup is processing. */
    private ProgressDialog dialog;

    public ProgressTask(ScanInboxActivity activity) {
        dialog = new ProgressDialog(activity);
        dialog.setIndeterminate(true);
        dialog.setCancelable(false);
        dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
        dialog.setMax(totalSms);
    }

    protected void onPreExecute() {
        dialog.setMessage("Scan start");
        dialog.show();
    }

    @Override
    protected void onProgressUpdate(Integer... values) {
        Log.d(TAG, "in onProgressUpdate: " + values[0]); // shows actuall count in the log
        dialog.setProgress(values[0]); // does not update

                    //tried even this, …
Run Code Online (Sandbox Code Playgroud)

android android-progressbar

4
推荐指数
1
解决办法
1496
查看次数

ProgressBar drawable如何工作?

背景

我想作一个圆形的进度条是确定的(意思是机器人:不确定="假"),所以我在网上搜索,发现罗曼盖伊的简短的回答,在这里.

所以我抓住了代码并在示例项目中使用它:

布局文件的(部分):

<ProgressBar
    android:layout_width="50dp"
    android:layout_height="50dp"
    android:background="@color/backColor"
    android:indeterminate="false"
    android:indeterminateOnly="false"
    android:max="100"
    android:progress="33"
    android:progressDrawable="@drawable/progress" />
Run Code Online (Sandbox Code Playgroud)

绘制/ progress.xml

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >

<!--    <item android:drawable="@drawable/progress_circular_background"/> -->
    <item>
        <shape  
            android:innerRadiusRatio="3.4"
            android:shape="ring"
            android:thicknessRatio="6.0" >
            <gradient
                android:endColor="#ffffffff"
                android:startColor="#ff000000"  
                android:type="sweep"
                android:useLevel="true" />

        </shape>
    </item>

    <item>
        <rotate
            android:drawable="@drawable/progress_particle"
            android:fromDegrees="0"
            android:pivotX="50%"
            android:pivotY="50%"
            android:toDegrees="360" />
    </item>

</layer-list>
Run Code Online (Sandbox Code Playgroud)

截图(不完全是当前代码):

在此输入图像描述

这个问题

它工作正常,但我不明白它是如何工作的.

进度条如何知道在drawables上究竟要改变什么,以及如何改变?

例如,它如何知道如何从右边0度而不是从其他地方获取戒指形状?

是否可以自定义它的工作方式?

android android-progressbar android-drawable

4
推荐指数
1
解决办法
6570
查看次数

Android线加载动画

如何在Android中制作像这样或类似的动画?

我不知道从哪里开始,如何制作线条以及如何使它们移动.

请参阅本网站上显示的进度条:http://tinyurl.com/oqy8zef

animation android loading android-progressbar

4
推荐指数
1
解决办法
3515
查看次数

如何在列表视图中放置一个ProgressBar?

我有一个AsyncTask中填充的ListView。在运行时,ListView变为不可见,ProgressBar显示在水平中心,在AsyncTask完成后消失,然后再次显示ListView。现在看起来像这样:

在此处输入图片说明

但是我需要将ProgressBar显示在ListView的内部,并且水平和垂直居中:

在此处输入图片说明

这是我的布局标记:

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:layout_weight="1">

    <LinearLayout
            android:id="@+id/LinearHeaderProgress"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:gravity="center"
            android:orientation="vertical"
            android:visibility="gone">

        <ProgressBar
                android:id="@+id/HeaderProgress"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content">
        </ProgressBar>
    </LinearLayout>

    <ListView
            android:layout_width="fill_parent"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:id="@+id/listView"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

我该如何实现?

谢谢。

markup android android-listview android-progressbar

4
推荐指数
1
解决办法
1630
查看次数

ProgressBar垃圾邮件Logcat

我疯了 在我的应用程序中,我使用带有自定义drawable的进度条.除了每次调用setProgress(int progress)进度条的方法时我的logcat都会收到垃圾邮件,一切都运行得很好.

消息看起来像这样:

12-09 17:11:54.250 5918-5918/com.mypackage D/ProgressBar:setProgress = 33,fromUser = false 12-09 17:11:54.250 5918-5918/com.mypackage D/ProgressBar:mProgress = 33mIndeterminate = false ,mMin = 0,mMax = 100

这些消息肯定不是来自我的代码,我没有在这里找到任何相关的搜索.

这是我在xml中的进度条:

            <ProgressBar
            android:id="@+id/progress_gpx_simulation"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:max="100"
            android:progress="0"
            android:indeterminate="false"
            style="?android:attr/progressBarStyleHorizontal"
            android:progressDrawable="@drawable/myprogressbar"
            android:layout_marginBottom="5dp" />
Run Code Online (Sandbox Code Playgroud)

这就是我以编程方式访问它的方式:

Progressbar progressBarGpxSimulation = (ProgressBar) view.findViewById(R.id.progress_gpx_simulation);
progressBarGpxSimulation.setProgress((int) progress);
Run Code Online (Sandbox Code Playgroud)

有没有办法关闭这些消息?我经常更新进度,无法读取其他日志消息.

问候

android android-progressbar android-logcat

4
推荐指数
1
解决办法
1253
查看次数

自定义ProgressBar成为温度计

如何自定义ProgressBar看起来像温度计?有可能改变颜色.

温度计蓝色充分 温度计蓝色空 温度计红色满 温度计红色空

我的建议是将progressBar旋转90°变为垂直,然后覆盖一个空的温度计的图像,但这是一个糟糕而混乱的解决方案.

我认为最好是扩展View或ProgressBar类并自定义绘制方法,但我不知道如何绘制温度计,任何帮助将不胜感激.

android drawing draw android-custom-view android-progressbar

4
推荐指数
1
解决办法
2995
查看次数

如何为进度通知图标设置动画

我正在以下面给出的方式构建服务中的通知进度条:

private NotificationManager mNotifyManager;
private NotificationCompat.Builder mBuilder;



 mBuilder =
                    new NotificationCompat.Builder(DownloadService.this)
                            .setSmallIcon(R.drawable.download)
                            .setContentTitle("MayUp")
                            .setContentText("Downloading new tools")
                            .setTicker("Downloading in progress");
            mBuilder.setAutoCancel(true);
            Intent targetIntent = new Intent(DownloadService.this, ListClass.class);
            TaskStackBuilder stackBuilder = TaskStackBuilder.create(DownloadService.this);
            // Adds the back stack for the Intent (but not the Intent itself)
            stackBuilder.addParentStack(MyActivity.class);
            // Adds the Intent that starts the Activity to the top of the stack
            stackBuilder.addNextIntent(targetIntent);
//            PendingIntent contentIntent = PendingIntent.getActivity(DownloadService.this, 0, targetIntent, PendingIntent.FLAG_UPDATE_CURRENT);
//            mBuilder.setContentIntent(contentIntent);
            PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0,
                    PendingIntent.FLAG_UPDATE_CURRENT);
            mBuilder.setContentIntent(resultPendingIntent);

            mNotifyManager.notify(1, mBuilder.build());

            mBuilder.setProgress(100, 0, false); …
Run Code Online (Sandbox Code Playgroud)

android android-progressbar android-notifications android-notification-bar

4
推荐指数
3
解决办法
7391
查看次数

如何使用paint赋予圆圈边框

嗨,我已经实现了进度条,它工作正常,但我的问题是我需要使用油漆给一个唯一的边框圆.我研究过这个,但是它占据了所有的圆形区域,我只需要边框.

我的油漆代码:

    mCirclePaint = new Paint();
    mCirclePaint.setAntiAlias(true);
    mCirclePaint.setDither(true);
    mCirclePaint.setColor(mCircleColor);
    mCirclePaint.setStrokeWidth(mCircleStrokeWidth);
    mCirclePaint.setStyle(Paint.Style.STROKE);
    mCirclePaint.setStrokeJoin(Paint.Join.MITER);
    // mCirclePaint.setShadowLayer(4.0f, 0.0f, 2.0f, Color.BLACK);
    mCirclePaint.setStrokeCap(Paint.Cap.SQUARE);
    canvas.drawPath(mCirclePath, mCirclePaint)
Run Code Online (Sandbox Code Playgroud)

android paint stroke android-progressbar

4
推荐指数
1
解决办法
6581
查看次数

如何设置圆形不确定进度条的厚度android?

我有两个嵌套的圆形不确定进度条,但我不能将它们的厚度设置为相同的大小.我试图使用形状自定义它.但是,这会删除循环不确定进度的默认行为.我这样定制,它使厚度相等,但没有得到默认行为.

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@android:id/progress">
        <rotate android:toDegrees="360">
            <shape
                android:shape="ring"
                android:thickness="4dp">
                <solid android:color="@color/white" />
            </shape>
        </rotate>
    </item>
</layer-list>

<ProgressBar
      android:id="@+id/download_progress4"
      android:layout_width="85dp"
      android:layout_height="85dp"
      android:layout_gravity="center"
      android:indeterminate="true"
      android:indeterminateDrawable="@style/ProgressThem" />
Run Code Online (Sandbox Code Playgroud)

我希望这样的循环不确定进度条的默认行为

但我希望像圆形不确定进度条的默认行为

java android android-layout android-progressbar android-xml

4
推荐指数
3
解决办法
3737
查看次数