我不知道为什么会这样:用离子库加载图像后,我的图像在图像的上方和下方显示了两个白条。我不想那样



我的ImageView显示在列表视图项中。我的适配器代码如下所示:

如果(node.getImageUrl()!= null){
    ivImage.setVisibility(View.VISIBLE);
    Ion.with(ivImage)
            .placeholder(R.drawable.anne_eli_icons_set_up_anne_eli_logo_530px)
            //.error(R.drawable.error_image)
            //.animateLoad(android.R.anim.cycle_interpolator)
            .animateIn(android.R.anim.fade_in)
            .load(“ http://app.anne-eli.at/” + node.getImageUrl()。getUrlBig());


}其他{
    ivImage.setVisibility(View.GONE);
}


我的imageview布局是这样的:
<LinearLayout ... <ImageView android:id="@+id/fragment_appointment_list_item_article_iv_image" android:layout_width="match_parent" android:layout_height="wrap_content" android:src="@drawable/anne_eli_icons_set_up_anne_eli_logo_530px" android:background="@color/gray1" /></LinearLayout>

有任何想法吗?

最佳答案

将您的imageview布局更改为此:

<LinearLayout ...
<ImageView
        android:id="@+id/fragment_appointment_list_item_article_iv_image"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:scaleType="fitXY" <!-- this line added , also your can use other value too like cropCenter ... -->
        android:src="@drawable/anne_eli_icons_set_up_anne_eli_logo_530px"
        android:background="@color/gray1" />
</LinearLayout>

07-24 09:47
查看更多