Fresco: 圆形进度条

创建于 2015-12-28  ·  4评论  ·  资料来源: facebook/fresco

嗨朋友们,
我有一个问题,在我的应用程序中我使用 SimpleDraweeView 并且我想在 SimpleDraweeView 加载图像时使用圆形进度条覆盖。
请帮助我。
我的代码:
android:layout_width="match_parent"
android:layout_height="wrap_content">

        <com.facebook.drawee.view.SimpleDraweeView
            android:id="@+id/adapter_detail_iv"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:visibility="gone"
            fresco:placeholderImage="@drawable/bg_default_loading_image" />

        <LinearLayout
            android:id="@+id/layout_progressbar"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="center"
            android:background="#33000000"
            android:gravity="center"
            android:orientation="vertical"
            android:visibility="gone">

            <ProgressBar
                android:id="@+id/indeterminate_progress_large_library"
                style="@style/Widget.MaterialProgressBar.ProgressBar.Small"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:indeterminate="true"
                android:visibility="gone" />
        </LinearLayout>
    </FrameLayout>

最有用的评论

@cazador4我试图实现你的CircleProgressBarDrawable ,但我得到的是椭圆形而不是圆形。 可能是什么问题呢? 也许是因为我的 DraweeView 不是方形的?

所有4条评论

也许这会对你有所帮助。
https://github.com/facebook/fresco/pull/775

或者,fresco 已经有一个不确定的进度指示器。 您可以将 AutoRotateDrawable 用于 ProgressBarDrawable。

@cazador4我试图实现你的CircleProgressBarDrawable ,但我得到的是椭圆形而不是圆形。 可能是什么问题呢? 也许是因为我的 DraweeView 不是方形的?

@cazador4我试图实现你的CircleProgressBarDrawable ,但我得到的是椭圆形而不是圆形。 可能是什么问题呢? 也许是因为我的 DraweeView 不是方形的?

这可能是问题所在。
无论如何,使用

setPlaceholderImage(
                        AutoRotateDrawable(
                            ContextCompat.getDrawable(
                                postMediaHolder.context,
                                R.drawable.ic_refresh
                            ), 1000
                        ), ScalingUtils.ScaleType.CENTER
                    )

它应该居中,固定宽高比和drawable的缩放。

此页面是否有帮助?
0 / 5 - 0 等级