Ofe*_*mon 2 size android pixels imageview
我正在使用 AsyncTask 类从网络加载图像,并将其设置为我的代码中的图像视图。
// loading of the image into the ImageView
new DownloadImageTask(MyImageView).execute("ImageURL");
Run Code Online (Sandbox Code Playgroud)
问题是,每次加载图像时,它的高度都是不同的,即使 ImageView 的宽度和高度是 warp_content。我添加了一种带有背景和填充的边界线以查看它的实际高度。 这是xml
<ImageView
android:id="@+id/ivBigRecipeImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_margin="5dp"
android:layout_toRightOf="@+id/ingredientsTitle"
android:background="#52D017"
android:contentDescription="food"
android:padding="1dp" />
Run Code Online (Sandbox Code Playgroud)
在这里是照片
有时会发生这种情况:

有时会发生这种情况:

有任何想法吗?我只想让它的实际大小
谢谢!
| 归档时间: |
|
| 查看次数: |
487 次 |
| 最近记录: |