首页 > 解决方案 > android:constraintLayout中的视图不更新

问题描述

我有视图(activeListeningView),当我从 api 调用得到响应时,我想让它可见。我的问题是 activeListeningView 变得可见但 viewpager 覆盖它并且不关心边距。我尝试了很多方法,但没有任何效果

<com.irantracking.ptt.common.view.ActiveListeningView
        android:id="@+id/active_listening"
        android:layout_width="match_parent"
        android:layout_height="56dp"
        android:visibility="gone"
        android:layout_marginTop="16dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="parent"/>


    <androidx.viewpager.widget.ViewPager
        android:id="@+id/view_pager"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_marginTop="16dp"
        app:layout_goneMarginTop="0dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/active_listening" />

标签: androidandroid-constraintlayout

解决方案


推荐阅读