<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                本文內容包括: [TOC] ## 自定義網絡加載 Image pipeline 默認使用 HttpURLConnection 。應用可以根據自己需求使用不同的網絡庫。 ### OkHttp OkHttp 是一個流行的開源網絡請求庫。Imagepipeline有一個使用OkHttp替換掉了Android默認的網絡請求的補充。 如果需要使用OkHttp,不要使用這個[下載](#)頁面的gradle依賴配置,應該使用下面的依賴配置 ~~~groovy dependencies { // your project's other dependencies compile: "com.facebook.fresco:drawee:0.1.0+" compile: "com.facebook.fresco:imagepipeline-okhttp:0.1.0+" } ~~~ 配置Imagepipeline這時也有一些不同,不再使用`ImagePipelineConfig.newBuilder`,而是使用`OkHttpImagePipelineConfigFactory`: ~~~java Context context; OkHttpClient okHttpClient; // build on your own ImagePipelineConfig config = OkHttpImagePipelineConfigFactory .newBuilder(context, okHttpClient) . // other setters . // setNetworkFetchProducer is already called for you .build(); Fresco.initialize(context, config); ~~~ ### 使用自定的網絡層 For complete control on how the networking layer should behave, you can provide one for your app. You must subclass 為了完全控制網絡層的行為,你可以自定義網絡層。繼承 NetworkFetchProducer , 這個類包含了網絡通信。 你也可以選擇性地繼承 NfpRequestState , 這個類是請求時的數據結構描述。 默認的 `HttpURLConnection` 可以作為一個參考. 在配置 Image pipeline 時,把producer傳遞給Image pipeline。 ~~~java ImagePipelineConfig config = ImagePipelineConfig.newBuilder() .setNetworkFetchProducer(myNetworkFetchProducer); . // other setters .build(); Fresco.initialize(context, config); ~~~ ## 使用其他的Image Loader Drawee 并不是吊死在特定的一種圖片加載機制上,它同樣適用于其他 image loader。 不過有一些特性,只有Fresco image pipeline才有。前面的提到的需要使用 ImageRequest 和配置 imagepipeline的特性,使用其他image loader時都有可能不起作用。 ### Drawee 和 Volley ImageLoader配合使用 我們有一個Drawee使用Volley的 ImageLoader 的補充實現。 我們僅僅對那些已經深度使用Volley ImageLoader的應用推薦這個組合。 同樣地,如要使用,使用下面的依賴,而不是[下載](#)頁面給出的依賴: ~~~groovy dependencies { // your project's other dependencies compile: "com.facebook.fresco:drawee-volley:0.1.0+" } ~~~ ### 初始化Volley ImageLoader 這時,不需要再調用`Fresco.initialize`了,需要的是初始化Volley。 ~~~java Context context; ImageLoader imageLoader; // build yourself VolleyDraweeControllerBuilderSupplier mControllerBuilderSupplier = new VolleyDraweeControllerBuilderSupplier(context, imageLoader); SimpleDraweeView.initialize(mControllerBuilderSupplier); ~~~ 不要讓 `VolleyDraweeControllerBuilderSupplier`離開作用域,你需要它來創建DraweeController,除非你只使用`SimpleDraweeView.setImageURI`。 ### DraweeControllers 和 Volley ImageLoader 配合使用 不是調用`Fresco.newControllerBuilder`, 而是: ~~~java VolleyController controller = mControllerBuilderSupplier .newControllerBuilder() . // setters .build(); mSimpleDraweeView.setController(controller); ~~~ ### Drawee 和其他Image Loader 配合使用 依照[源碼](https://github.com/facebook/fresco/tree/master/drawee-backends/drawee-volley/src/main/java/com/facebook/drawee/backends/volley) 作為例子,其他Image Loader也是可以和Drawee配合使用的,但是沒有我們還沒有Drawee和其他Image loader的配合使用的補充實現。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看