android imageloader和imageview scaletype

时间:2015-06-15 08:36:26

标签: android imageview universal-image-loader

this is my image我有一个imageview元素进入relativelayout,使用textView就像这样

<RelativeLayout>
<ImageView
    android:id="@+id/image"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:adjustViewBounds="true"
   android:background="@color/darkblue"
    android:scaleType="fitXY"/>

  <TextView
    android:id="@+id/title"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"

android:layout_alignBottom="@+id/image"
android:paddingBottom="2dp"
android:gravity="bottom"
  android:paddingLeft="2dp"
  android:paddingRight="2dp"
   android:textSize="13sp"
   android:background="@drawable/gradient"
    android:textColor="@color/White"
     />

 </RelativeLayout>

我想使用imageloader加载图像,但是当我加载图像时图像的高度没有填满所有的相对布局,我尝试使用scaletype:fitcenter但仍然无法正常工作,我尝试更改图像的高度以语法方式但仍未显示所有高度,

    image.getLayoutParams().height=(int) (screenWidth/2);

1 个答案:

答案 0 :(得分:1)

试试android:scaleType="centerCrop" here你可以阅读更多关于这个的信息

相关问题