0

如下图所示,相机预览的每一侧都有白条。

有问题的应用程序

填充和边距不起作用,我找不到任何使它成为编程定义宽度的东西。不过,如果它是通过编程方式定义的,则可以在此处找到。

我的 XML 都是 Navigation Drawer Activity 预设的默认值,除了下面这个:

main_activity.xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout 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:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">

<eu.livotov.labs.android.camview.ScannerLiveView
    android:id="@+id/camview"
    android:layout_width="fill_parent"
    android:layout_height="match_parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent" />

<include
    layout="@layout/app_bar_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

<android.support.design.widget.NavigationView
    android:id="@+id/nav_view"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:fitsSystemWindows="true"
    app:headerLayout="@layout/nav_header_main"
    app:menu="@menu/activity_main_drawer" >

</android.support.design.widget.NavigationView>

我试图改变我能想到的一切,但我不一定擅长 UI

4

1 回答 1

0

我的解决方案:

不要使用eu.livotov.labs.android.camview.ScannerLiveView

我改为切换到com.google.android.cameraview.CameraView,这是一个你可以在Github上找到的库。

由于 Google 终于为其相机 API 添加了更高级别的支持,我很快就会切换到Jetpack CameraX 。

于 2020-04-20T20:57:03.683 回答