2012-12-05 35 views
0

圖像不是全幅顯示,即使我給(機器人:layout_width =「FILL_PARENT」),以我的ImageView類圖像不設定的ImageView到FILL_PARENT

<ImageView android:id="@+id/img" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_above="@+id/button_layout" 
    android:layout_below="@+id/middle1" 
     /> 

在這裏,我得到了我的位圖

if (orientation != 0) { 
         Matrix matrix = new Matrix(); 
         matrix.postRotate(orientation); 
         bMapRotate = Bitmap.createBitmap(bmp, 0, 0, bmp.getWidth(), 
           bmp.getHeight(), matrix, true); 
        } else 
         bMapRotate = Bitmap.createScaledBitmap(bmp, bmp.getWidth(), 
           bmp.getHeight(), true); 
        findViewById(R.id.img).setVisibility(View.VISIBLE); 
//Here I set the bitmap     ((ImageView)findViewById(R.id.img)).setImageBitmap(bMapRotate); 
        findViewById(R.id.preview).setVisibility(View.GONE); 

我無法理解爲什麼它不拍攝畫面全長eventhough我給FILL_PARENT到的ImageView在我的XML

+0

嘗試用大規模properity玩後確保您的位圖 – Mikhaili

+0

是U做setImageBitmap? ?和你使用矩陣的位圖?? – sheetal

+0

你在做什麼?您想要在定位更改時縮放與設備屏幕大小相同的圖像嗎? – nalaiqChughtai

回答

0

看一看的ImageView的scaleType元素。你可能想fitXY我想......

0
setScaleType(ImageView.ScaleType.MATRIX); 

試試這個您的ImageView和創造的返回相同的寬度屏幕寬度