2012-12-05 30 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和创造的返回相同的宽度屏幕宽度