2014-01-21 19 views
1

工具欄:機器人:調整圖像模糊的第二頁上

#main_bar { 
    background: url(../images/logo.jpg) 99% 50% no-repeat; 
    background-size: auto 80%; 
} 

logo.jpg原始尺寸220x266px

工具欄的高度爲46px

這樣的背景圖像約爲高度36px

工具欄在所有頁面上都是一樣的(共有2頁)

我的問題是: 應用程序啓動時圖像看起來很完美。當我轉到第二頁時,它變得模糊。當我回到第一頁時,它仍然很模糊。

如果換成

background-size: auto 36px; 

問題仍然存在

有什麼建議?

謝謝 伊琳娜

回答

0

公共位圖resizeBitMapImage1(字符串文件路徑,詮釋targetWidth,INT targetHeight) {

  Bitmap bitMapImage = null; 
     Options options = new Options(); 
     options.inJustDecodeBounds = true; 
     BitmapFactory.decodeFile(filePath, options); 
     double sampleSize = 0; 

     Boolean scaleByHeight = Math.abs(options.outHeight - targetHeight) >= Math 
       .abs(options.outWidth - targetWidth); 

     if (options.outHeight * options.outWidth * 2 >= 1638) { 

      sampleSize = scaleByHeight ? options.outHeight/targetHeight 
        : options.outWidth/targetWidth; 
      sampleSize = (int) Math.pow(2d, 
        Math.floor(Math.log(sampleSize)/Math.log(2d))); 
     } 


     options.inJustDecodeBounds = false; 
     options.inTempStorage = new byte[128]; 
     while (true) { 
      try { 
       options.inSampleSize = (int) sampleSize; 
       bitMapImage = BitmapFactory.decodeFile(filePath, options); 

       break; 
      } catch (Exception ex) { 
       try { 
        sampleSize = sampleSize * 2; 
       } catch (Exception ex1) { 

       } 
      } 
     } 

     return bitMapImage; 
    }