<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>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                在前幾篇博客中,你已經知道如何從不同的資源中加載圖片,以及哪些不同的方式的占位符。這周的博客是重要的,如果你不能支配圖片的大小去加載:調整大小和縮放。 **用 resize(x,y) 調整圖片大小?** 通常情況下,如果你的服務器或者 API 提供的圖像是你需要的精確馳卻,這時是完美的情況下,在內存小號和圖像質量之間的權衡。 在和 Picasso 比較后,Glide 有[更加高效](https://inthecheesefactory.com/blog/get-to-know-glide-recommended-by-google/en)的內存管理。Glide 自動限制了圖片的尺寸在緩存和內存中,并給到 `ImageView` 需要的尺寸。Picasso 也有這樣的能力,但需要調用 `fit()` 方法。對于 Glide,如果圖片不會自動適配到 `ImageView`,調用 `override(horizontalSize, verticalSize) `。這將在圖片顯示到 `ImageView`之前重新改變圖片大小。 ~~~ Glide .with(context) .load(UsageExampleListViewAdapter.eatFoodyImages[0]) .override(600, 200) // resizes the image to these dimensions (in pixel). does not respect aspect ratio .into(imageViewResize); ~~~ 當你還沒有目標 view 去知道尺寸的時候,這個選項也可能是有用的。比如,如果 App 想要在閃屏界面預熱緩存,它還不能測量 `ImageView` 的尺寸。然而,如果你知道這個圖片多少大,用 override 去提供明確的尺寸。 **縮放圖像**? 現在,對于任何圖像操作,調整大小真的能讓長寬比失真并且丑化圖像顯示。在你大多數的使用場景中,你想要避免發生這種情況。Glide 提供了一般變化去處理圖像顯示。提供了兩個標準選項:`centerCrop` 和 `fitCenter`。 **CenterCrop**? `CenterCrop()`是一個裁剪技術,即縮放圖像讓它填充到 `ImageView` 界限內并且側鍵額外的部分。`ImageView` 可能會完全填充,但圖像可能不會完整顯示。 ~~~ Glide .with(context) .load(UsageExampleListViewAdapter.eatFoodyImages[0]) .override(600, 200) // resizes the image to these dimensions (in pixel) .centerCrop() // this cropping technique scales the image so that it fills the requested bounds and then crops the extra. .into(imageViewResizeCenterCrop); ~~~ **FitCenter**? `fitCenter()` 是裁剪技術,即縮放圖像讓圖像都測量出來等于或小于 `ImageView` 的邊界范圍。該圖像將會完全顯示,但可能不會填滿整個 `ImageView`。 ~~~ Glide .with(context) .load(UsageExampleListViewAdapter.eatFoodyImages[0]) .override(600, 200) .fitCenter() .into(imageViewResizeFitCenter); ~~~ 我們會在以后的博客去做自定義的轉換,以及 centerCrop() 和 fitCenter() 。 **Outlook**? 在這篇博客中,你學會如何去對圖像的大小和顯示進行調整。這對創建一個很棒的應用非常具有幫助。在我們進入 Glide 進階課程之前,我們來看一個 Glide 很獨特的功能:顯示 Gif 和 video。
                  <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>

                              哎呀哎呀视频在线观看