无论我尝试什么方法,都无法设置从soap服务传递到我的android模拟器的图像的宽度和高度。 我正在使用以下ImageView:
在上面的代码中,我试图手动设置一个具有259像素宽度和194像素高度的jpeg图像的宽度和高度。
/res/layout/main.xml看起来像:
在尝试下面答案中的一些方法之后,我在我的模拟器上只看到了以下内容。我甚至不确定我所采取的方法是否正确。大多数我从搜索论坛中找到的解决方案对我来说都不起作用。有什么建议吗?
byte[] bloc = Base64.decode(result, Base64.DEFAULT);
Bitmap bmp = BitmapFactory.decodeByteArray(bloc,0,bloc.length);
ImageView image = new ImageView(this);
image.setImageBitmap(bmp);
image.setLayoutParams(
new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT));
image.getLayoutParams().height = 100;
image.getLayoutParams().width = 100;
setContentView(image);
在上面的代码中,我试图手动设置一个具有259像素宽度和194像素高度的jpeg图像的宽度和高度。
/res/layout/main.xml看起来像:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:weightSum="1" android:id="@+id/llid">
</LinearLayout>
在尝试下面答案中的一些方法之后,我在我的模拟器上只看到了以下内容。我甚至不确定我所采取的方法是否正确。大多数我从搜索论坛中找到的解决方案对我来说都不起作用。有什么建议吗?