可绘制只旋转一次

时间:2018-01-13 16:50:50

标签: android progress-bar fresco

我创建了自定义进度条,以便在从网络加载图像时在Fresco SimpleDraweeView中显示。我希望进度条不确定 Progressbar只旋转一次,然后drawable只是保持静止。这是进度条的xml代码。

custom_progress_bar.xml

<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
    android:pivotX="50%"
    android:pivotY="50%"
    android:fromDegrees="0"
    android:toDegrees="360">

    <shape
        android:shape="ring"
        android:innerRadiusRatio="3"
        android:thicknessRatio="15"
        android:useLevel="false">

        <size android:width="24dip" android:height="24dip" />

        <gradient
            android:type="sweep"
            android:useLevel="false"
            android:startColor="#00FFFFFF"
            android:centerColor="#97A4001D"
            android:centerY="0.50"
            android:endColor="#FFA4001D" />

    </shape>

</rotate> 

Fresco SimpleDraweeView用于另一种布局。

<com.facebook.drawee.view.SimpleDraweeView xmlns:fresco="http://schemas.android.com/apk/res-auto"
                    android:id="@+id/full_view_image"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:adjustViewBounds="true"
                    fresco:actualImageScaleType="centerCrop"
                    android:visibility="gone"
                    fresco:failureImage="@drawable/ic_broken_image_black_24dp"
                    fresco:failureImageScaleType="centerInside"
                    android:background="@color/com_facebook_button_border_color_focused"
                    fresco:progressBarImage="@drawable/custom_progress_bar"
                    fresco:progressBarImageScaleType="centerInside"/>

2 个答案:

答案 0 :(得分:1)

(copyExistsOnList ? $uibModal.open({...}).result : Promise.resolve(wish)) .then(function (wish) { wishModel.createWish(newWish, userID, userID, wish._id); }); 添加到android:repeatCount="infinite"

下的custom_progress_bar.xml

答案 1 :(得分:0)

fresco:progressBarAutoRotateInterval="1000" 将以上属性添加到SimpleDraweeView节省了我的一天。

<com.facebook.drawee.view.SimpleDraweeView xmlns:fresco="http://schemas.android.com/apk/res-auto"
                android:id="@+id/video_thumbnail"
                app:layout_aspectRatio="145%"
                app:layout_widthPercent="100%"
                fresco:failureImage="@drawable/ic_broken_image_black_24dp"
                fresco:failureImageScaleType="centerInside"
                android:background="@color/com_facebook_button_border_color_focused"
                fresco:progressBarImage="@drawable/crafter_progress_bar"
                fresco:progressBarAutoRotateInterval="1000"
                fresco:progressBarImageScaleType="centerInside"/>