【发布时间】:2020-06-12 03:10:08
【问题描述】:
Android Studio Camera2 预览画面无法添加 UI。 我想知道我是否可以在相机预览屏幕上添加其他 UI? (标题栏、按钮、文本等) 我尝试在 XML 设置中添加上述 UI 元素,但在执行过程中仍然没有响应。
以下是我的activity_main.xml代码:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:orientation="vertical"
tools:context=".MainActivity">
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="657dp"
android:background="#000"
android:orientation="vertical"
tools:context=".MainActivity">
</FrameLayout>
</RelativeLayout>
以下是我的fragment_camera.xml代码:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:orientation="vertical"
tools:context=".CameraFragment">
<com.lightweh.camera2preview.AutoFitTextureView
android:id="@+id/textureView"
android:layout_width="wrap_content"
android:layout_height="match_parent"/>
</FrameLayout >
【问题讨论】:
标签: java xml android-studio layout android-camera2