【发布时间】:2015-07-31 20:04:16
【问题描述】:
嘿,我从 Android 开始我的冒险,但我无法解决一个问题。 我正在使用 Universal Image Loader 从 Web 服务器加载图片。我将它们放入位于 ListView 中的相对布局中。我想要达到的效果,就是图片全宽全高显示在整个屏幕上,底部有一个小框。 在 IDE 预览中,一切正常:
但在我的手机上加载的图像看起来像这样。我希望它们以全高显示。是否需要使用编程函数来实现?
加载图片:
imageLoader.displayImage(
wallpapers.get(position).getSrcUrl()//the drawable
, currentWallpaperViewHolder.imageViewWallpaper//the image view
, imageLoaderOptions);//the display options
return itemView;
列表视图:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<ListView
android:id="@+id/WallpapersListView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
图像视图:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/wallpaper_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:src="@drawable/test"
/>
<TextView
android:id="@+id/wallpaper_date_for_use"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dip"
android:padding="12dip"
android:background="#AA000000"
android:textColor="#ffffffff"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:gravity="center"
android:textStyle="bold"
android:text="Date of use" />
</RelativeLayout>
【问题讨论】:
标签: android android-layout android-imageview android-view universal-image-loader