我不完全明白的地方我的问题所在,所以我将提供尽可能多的信息,我可以,它的一些可能是无关找到了答案,但有些可能会有所帮助。位图不扩展到ImageView的
问题
我已经集成了一个摄像头在我的应用程序中,我使用的是surfaceView显示相机的预览,拍摄图像时,我采取原始图像字节和发送他们通过一个ObjectOutput流,我将显示该活动的图像。下面是该代码的一个片段:
out = new ObjectOutputStream(new FileOutputStream(new File(getActivity().getCacheDir(),"")+"cacheFile.srl"));
out.writeObject(bytes);
在我的字节读取和其他活动形象示:
bytes = (byte[]) in.readObject();
image = BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
myHolder.setImageBitmap(image);
下面是活动我的XML文件,该文件显示图像:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".fragments.Home">
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:id="@+id/ih"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"/>
如果需要任何其他信息,请让我知道和虐待更新后
更新1
我改变了我的布局是:
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
android:id="@+id/ih"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:layout_marginBottom="100dp"/>
但我仍然有白线或者侧
阅读有关'ImageView'的'scaleType's – pskink
请您可以共享图像的分辨率和设备? –