如何使视图的大小与自定义TextureVIew Android的大小相同

如何使视图的大小与自定义TextureVIew Android的大小相同,android,xml,Android,Xml,我有密码: <FrameLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentStart="true" android:layout_alignParentTop="true" android:background="#000000" android:id="@+id/frame"> <Vi

我有密码:

<FrameLayout
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:layout_alignParentStart="true"
  android:layout_alignParentTop="true"
  android:background="#000000"
  android:id="@+id/frame">
    <View
      android:id="@+id/tapView"
      android:background="#0000ff"
      android:layout_height="fill_parent"
      android:layout_width="fill_parent"/>
    <com.example.yApp.MyTextureView
      android:id="@+id/texture"
      android:background="#ff0000"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content" />
</FrameLayout>
<FrameLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_alignParentBottom="true"
      android:layout_alignParentStart="true">
<--- some code --->
</FrameLayout>

我的自定义TextureView按代码选择大小,我需要另一个视图(id=“tapView”),该视图的宽度和高度与我的自定义TextureView相同,并且位于屏幕上的同一位置


我的代码的问题是tapView延伸到全屏并与下一帧布局重叠

尝试使用
ConstraintLayout
,这两个视图都将具有

 app:layout_constraintStart_toStartOf="parent" 
 app:layout_constraintTop_toTopOf="parent"
 app:layout_constraintBottom_toBottomOf="@id/texture"
 app:layout_constraintEnd_toEndOf="@id/texture"
这景色会很美

 app:layout_constraintStart_toStartOf="parent" 
 app:layout_constraintTop_toTopOf="parent"
 app:layout_constraintBottom_toBottomOf="@id/texture"
 app:layout_constraintEnd_toEndOf="@id/texture"

匹配您的视图

这是您的全部布局代码吗?@parekhkruti26,不,它包含在相对布局中