Android FrameLayout项视图在切换其可见性后丢失z索引
我有以下介绍webRtc调用布局的布局Android FrameLayout项视图在切换其可见性后丢失z索引,android,kotlin,android-view,visibility,android-framelayout,Android,Kotlin,Android View,Visibility,Android Framelayout,我有以下介绍webRtc调用布局的布局 <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.activities.room.RoomActivity">
<FrameLayout
android:id="@+id/primaryFrame"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@color/colorPrimary"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/primaryPeerCircleText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="UU"
android:textAllCaps="true"
android:textSize="28sp"
android:padding="16dp"
android:textColor="@color/colorWhite"
android:background="@drawable/circle_white"
android:layout_gravity="center"/>
<org.webrtc.SurfaceViewRenderer
android:id="@+id/primaryParticipantView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
<TextView
android:id="@+id/primaryParticipantText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:background="@drawable/primary_background"
android:padding="4dp"
android:text=""
android:textColor="@color/colorWhite"
android:visibility="gone" />
<include
layout="@layout/local_peer_video"
android:layout_width="120dp"
android:layout_height="180dp"
android:layout_gravity="top|right"/>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom">
<HorizontalScrollView
android:id="@+id/horizontalContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@+id/controlsLayout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<LinearLayout
android:id="@+id/participantsContainer"
android:layout_width="wrap_content"
android:layout_height="180dp"
android:orientation="horizontal" />
</HorizontalScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
但是,当远程参与者再次启用视频时,会运行相同的代码片段,并将primaryParticipantView的可见性设置为可见。问题是,现在的primaryParticipantView
位于本地视频上方,因此我无法看到自己。为什么会这样
val remoteParticipant = session.getRemoteParticipant(params.getString("connectionId"))
runOnUiThread {
if (params.getString("property") == "videoActive")
remoteParticipant?.videoView?.visibility = if (params.getString("newValue") == "true") View.VISIBLE else View.GONE
}