我有代码:
<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按代码选择大小,我需要另一个View(id =“tapView”),其宽度和高度与我的自定义TextureView相同,也在屏幕上的相同位置。
我的代码问题是tapView延伸到全屏并重叠下一个FrameLayout
答案 0 :(得分:0)
尝试使用ConstraintLayout
,这两种视图都有
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
视图将有
app:layout_constraintBottom_toBottomOf="@id/texture"
app:layout_constraintEnd_toEndOf="@id/texture"
匹配您的观点