【发布时间】:2016-08-06 11:12:37
【问题描述】:
我在我的活动中显示了一个简单的ImageView:
<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="com.package.name.EditPicture">
<ImageView
android:id="@+id/problem_picture"
android:layout_width="wrap_content"
android:layout_height="match_parent" />
</RelativeLayout>
在我的活动课程中,这是我设置图像的方式:
//first calculate the width and height of the screen
DisplayMetrics displaymetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
int height = displaymetrics.heightPixels;
int width = displaymetrics.widthPixels;
//Then, resize the image's width and height equal to that of the screen:
Picasso.with(this).load(new File(pictureLocation)).rotate(90f).resize(height,width).into(imageView);
问题是,我在模拟器中得到了想要的结果,但在我真正的安卓手机中,什么都没有显示。整个屏幕都是空白的。
由于我已经将图像大小调整为屏幕大小,因此加载高分辨率图像应该没有任何问题。为什么在真机上我的屏幕是空白的?
【问题讨论】:
-
其他数据是否显示
-
我的布局中只有一个 ImageView,没有其他数据。
-
如何获取本地或服务器图像?
-
本地。它写在我的代码中。
.load(new File(pictureLocation)) -
您的外部或内部存储中有图像???
标签: android bitmap imageview picasso