ImageViewに設定する画像があります。
画像がない場合は、ImageViewで追加された空白を削除したい場合があります。設定する画像がない場合は、ImageViewの高さを削除します。
if(post.getImageUrl()!=null || !post.getImageUrl().equals("")) {
Picasso.with(context).load(post.getImageUrl()).into(holder.imageView);
}
else{
holder.imageView.setVisibility(View.GONE);
}
私のxml
<ImageView
android:layout_width="match_parent"
android:layout_height="500dp"
android:scaleType="centerCrop"
android:padding="0dp"
android:id="@+id/imageViewHero"
android:adjustViewBounds="true"/>
しかし、それは動作していない、空白はまだそこにあります。
I 'これを試してみてください、ありがとう –