fresco xml配置属性不起作用

在xml中配置加载等待图标,不起作用。

 

正确的如下:

 1 <?xml version="1.0" encoding="utf-8"?>
 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 3     xmlns:fresco="http://schemas.android.com/apk/res-auto"  //注意这行代码,之前就是因为写成tools不起作用
 4     android:id="@+id/linear_create_adver"
 5     android:layout_width="match_parent"
 6     android:layout_height="match_parent"
 7     android:background="@color/bg_activity"
 8     android:orientation="vertical">
 9 
10     <com.facebook.drawee.view.SimpleDraweeView
11                     android:id="@+id/iv_adver_pic"
12                     android:layout_width="150dp"
13                     android:layout_height="match_parent"
14                     android:layout_marginTop="5dp"
15                     android:layout_marginBottom="5dp"
16                     android:layout_marginRight="10dp"
17                     fresco:progressBarImage="@drawable/loading"
18                     fresco:progressBarAutoRotateInterval="1000"
19                     fresco:progressBarImageScaleType="center"
20                     fresco:actualImageScaleType="fitXY"/>
21 </LinearLayout>

java代码中设置:

1 DraweeController controller = Fresco.newDraweeControllerBuilder()
2                         .setUri(GlobalParams.gInitInfoEntity.getModel().getImage_url() + mAdverPicUrl)
3                         .setTapToRetryEnabled(true)
4                         .setOldController(ivAdverPic.getController())
5                         .build();
6                 ivAdverPic.setController(controller);

 

posted @ 2017-02-16 17:22  飞剑  阅读(1081)  评论(0编辑  收藏  举报