Frscon的使用

来源:互联网 发布:cnstorm和淘宝比哪个好 编辑:程序博客网 时间:2024/04/28 00:22
 

Frscon的报错:Error inflating class com.facebook.drawee.view.SimpleDraweeView

原因是没有执行,下面这句话

Fresco.initialize(this);
1.先要初始化    
Fresco.initialize(this);
2.导入包  
testCompile 'junit:junit:4.12'compile 'com.android.support:appcompat-v7:23.1.1'compile 'com.android.support:design:23.1.1'compile 'com.jakewharton:butterknife:7.0.1'compile 'com.bartoszlipinski.recyclerviewheader:library:1.2.0'compile 'com.squareup.retrofit2:adapter-rxjava:2.0.1'compile 'com.squareup.retrofit2:retrofit:2.0.1'compile 'com.squareup.retrofit2:converter-gson:2.0.1'compile 'com.google.code.gson:gson:2.6.2'compile 'com.facebook.fresco:fresco:0.9.0+'

3.布局文件的

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:fresco="http://schemas.android.com/apk/res-auto"    android:layout_width="180dp"    android:layout_height="wrap_content"    android:layout_gravity="center"    android:background="@drawable/dialog_radius"    android:orientation="vertical" >



<com.facebook.drawee.view.SimpleDraweeView    android:layout_weight="1"    android:id="@+id/iv_getCode"    android:layout_width="match_parent"    android:layout_height="34dp"    android:layout_alignParentRight="true"    android:layout_centerVertical="true"    android:layout_marginBottom="8dp"    android:layout_marginLeft="6dp"    android:layout_marginRight="8dp"    android:layout_marginTop="8dp"    android:adjustViewBounds="true"    android:background="@drawable/code_shape1"    fresco:roundAsCircle="true"      fresco:actualImageScaleType="focusCrop"/>圆形图片红色的三句
 fresco:roundedCornerRadius="180dp"
   fresco:actualImageScaleType="focusCrop"

4.使用的时候
ivGetCode=(ImageView)view.findViewById(R.id.iv_getCode);ivGetCode.setImageURI(Uri.parse(url));
基本就这些,很简单的
0 0
原创粉丝点击