Here's my layout
<ImageView
android:id="@+id/my_img1"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<ImageView
android:id="@+id/my_img2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"/>
Both ImageView were loaded with glide
Glide.with(MyImg1).load(Img1Url).into(MyImg1)
Glide.with(MyImg2).load(Img2Url).into(MyImg2)
When user click a button I just switch their visibility
if (MyImg1.visibility == View.VISIBLE) {
MyImg1.visibility = View.INVISIBLE
MyImg2.visibility = View.VISIBLE
}
else {
MyImg1.visibility = View.VISIBLE
MyImg2.visibility = View.INVISIBLE
}
Now the problem is MyImg2 will always be blank no matter how many times the switch button was click. If I change android:visibility="gone" from my_img2 and put it to my_img1 then MyImg2 will show and this means image loading is fine.