【发布时间】:2020-04-12 15:59:59
【问题描述】:
我想要一个水平的LinearLayout,其中包含一个SurfaceView 和一个View 作为我的Fragment 的内容。假设它们应该覆盖整个屏幕,宽度和高度大小相等。
当我尝试这个时,我只得到一个覆盖整个屏幕的SurfaceView,这让我想知道是否可以混合一个SurfaceView 和另一个View。
有谁知道这是否可能,如果可能,应该怎么做?
我的布局文件:
<LinearLayout
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"
android:orientation="vertical"
android:padding="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="horizontal">
<SurfaceView
android:id="@+id/SurfaceView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:padding="5dp"></SurfaceView>
<FrameLayout
android:id="@+id/AV"
android:layout_width="wrap_content"
android:layout_height="match_parent"
tools:visibility="visible">
<ImageView
android:id="@+id/FAV"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
app:srcCompat="@drawable/fond_vertical" />
<ImageView
android:id="@+id/CV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
app:srcCompat="@drawable/curseur" />
</FrameLayout>
</LinearLayout>
【问题讨论】:
-
在此处显示您的布局文件!
-
布局已添加到问题中!
标签: java android surfaceview