С тех пор конвертировать ConstraintLayout в MotionLayout handler.postdelayed не работает
это мои коды
Макет
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.motion.widget.MotionLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/jjjk"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary"
app:layoutDescription="@xml/chapter2_scene2">
<ImageView
android:id="@+id/image_view"
android:layout_width="0dp"
android:layout_height="0dp"
android:src="@drawable/ic_launcher_background"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHeight_percent="0.3"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_percent="0.5" />
</androidx.constraintlayout.motion.widget.MotionLayout>
Ява
Handler mHandler = new Handler();
mHandler.postDelayed(new Runnable() {
public void run() {
imageView.setVisibility(View.VISIBLE);
}
}, 100);
Но это работает, если я пишу imageView.setVisibility(View.VISIBLE);
вне handler.postdelayed
Проблема в том, что я android:visibility="gone"
вид изображения
Если я использую android:visibility="invisible"
, проблем нет
Но я хочу отложить отображение больших изображений этим методом, чтобы страница загружалась хорошо
В чем проблема?