I has constraint layout with ImageView inside it:
<ImageView
        android:id="@+id/iv_lottery"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="16dp"
        android:layout_marginTop="8dp"
        android:layout_marginEnd="16dp"
        android:visibility="gone"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/tv_lottery_info"
        tools:visibility="visible" />
In my fragment, when I recieve network response, I show ImageView and try load image from network via Picasso and resize it with autoheight.
mIvLottery.setVisibility(View.VISIBLE);
Picasso.get().load(mLottery.getBanner()).resize(mIvLottery.getWidth(), 0).into(mIvLottery);
The problem is: mIvLottery.getWidth() is 0.
How I can solve it?
If I change in xml layout android:visibility from gone to invisible or visible, all works fine. The problem is only when default visibility of ImageView is gone.
 
    