我的真实设备(手机)和模拟器上有不同比例的 ImageView。模拟器正确显示图像,但真实设备(电话)没有。设备(电话)屏幕上的图像变小。
这是我的java代码:
...
rootView = (ViewGroup) inflater.inflate(R.layout.arabic_page, container, false);
waraka = (ImageView) rootView.findViewById(R.id.waraka);
...
InputStream istr;
try {
//Search in OBB
istr = getExpansionFile().getInputStream(num_image+".png");
Bitmap bitmap = BitmapFactory.decodeStream(istr);
Drawable draw =new BitmapDrawable(getResources(),bitmap);
waraka.setImageDrawable(draw);
这是我的布局代码:
<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"
android:background="#FFFFFF"
tools:context=".MainActivity">
<ImageView
android:id="@+id/waraka"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentTop="true"
android:scaleType="fitCenter"/></RelativeLayout>