在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 教程/ Android/ 在XML中使用Drawees
進(jìn)度條
在JAVA代碼中使用Drawees
Drawee的各種效果配置
緩存
一些陷阱
關(guān)于在Android Studio中編譯
多圖請(qǐng)求及圖片復(fù)用
自定義網(wǎng)絡(luò)加載
支持的URIs
可關(guān)閉的引用
監(jiān)聽(tīng)下載事件
修改圖片
引入Fresco
縮放
圓角和圓圈
配置Image Pipeline
縮放和旋轉(zhuǎn)圖片
(圖片請(qǐng)求)Image Requests
自定義View
使用ControllerBuilder
在XML中使用Drawees
開(kāi)始使用 Fresco
關(guān)鍵概念
Image Pipeline介紹
漸進(jìn)式JPEG圖
數(shù)據(jù)源和數(shù)據(jù)訂閱者
直接使用Image Pipeline
動(dòng)畫(huà)圖(gif)
使用其他的Image Loader

在XML中使用Drawees

本教程內(nèi)容來(lái)源于:http://fresco-cn.org
采用 知識(shí)共享 署名 4.0 國(guó)際 許可協(xié)議 進(jìn)行許可

Drawees 具有極大的可定制性。

下面的例子給出了可以配置的各種選項(xiàng):

<com.facebook.drawee.view.SimpleDraweeView
    android:id="@+id/my_image_view"
    android:layout_width="20dp"
    android:layout_height="20dp"
    fresco:fadeDuration="300"
    fresco:actualImageScaleType="focusCrop"
    fresco:placeholderImage="@color/wait_color"
    fresco:placeholderImageScaleType="fitCenter"
    fresco:failureImage="@drawable/error"
    fresco:failureImageScaleType="centerInside"
    fresco:retryImage="@drawable/retrying"
    fresco:retryImageScaleType="centerCrop"
    fresco:progressBarImage="@drawable/progress_bar"
    fresco:progressBarImageScaleType="centerInside"
    fresco:progressBarAutoRotateInterval="1000"
    fresco:backgroundImage="@color/blue"
    fresco:overlayImage="@drawable/watermark"
    fresco:pressedStateOverlayImage="@color/red"
    fresco:roundAsCircle="false"
    fresco:roundedCornerRadius="1dp"
    fresco:roundTopLeft="true"
    fresco:roundTopRight="false"
    fresco:roundBottomLeft="false"
    fresco:roundBottomRight="true"
    fresco:roundWithOverlayColor="@color/corner_color"
    fresco:roundingBorderWidth="2dp"
    fresco:roundingBorderColor="@color/border_color"
  />

必須設(shè)置layout_width和layout_height

如果沒(méi)有在XML中聲明這兩個(gè)屬性,將無(wú)法正確加載圖像。

wrap_content

Drawees 不支持 wrap_content 屬性。

所下載的圖像可能和占位圖尺寸不一致,如果設(shè)置出錯(cuò)圖或者重試圖的話,這些圖的尺寸也可能和所下載的圖尺寸不一致。

如果大小不一致,圖像下載完之后,假設(shè)如果是wrap_content,View將會(huì)重新layout,改變大小和位置。這將會(huì)導(dǎo)致界面跳躍。

固定寬高比

只有希望顯示的固定寬高比時(shí),可以使用wrap_content

如果希望顯示的圖片保持一定寬高比例,如果 4:3,則在XML中:

<com.facebook.drawee.view.SimpleDraweeView
    android:id="@+id/my_image_view"
    android:layout_width="20dp"
    android:layout_height="wrap_content"
    <!-- other attributes -->

然后在代碼中指定顯示比例:

mSimpleDraweeView.setAspectRatio(1.33f);