Android 我的应用程序中的摄像头无法填充屏幕

Android 我的应用程序中的摄像头无法填充屏幕,android,android-camera,screen-size,Android,Android Camera,Screen Size,我的应用程序有一个问题,相机不适合右侧屏幕的末端,并且有一个巨大的黑色条。请帮忙。控制相机的代码不包括在内,因为有太多的输出无法放在堆栈溢出上。摄像头的大小主要取决于布局和AutoFitTextureView.java。请帮忙 camera2_basic.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/

我的应用程序有一个问题,相机不适合右侧屏幕的末端,并且有一个巨大的黑色条。请帮忙。控制相机的代码不包括在内,因为有太多的输出无法放在堆栈溢出上。摄像头的大小主要取决于布局和AutoFitTextureView.java。请帮忙

camera2_basic.xml

    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
 >


    <com.technologyfortomorrow.animalyze.AutoFitTextureView
        android:id="@+id/texture"
        android:layout_width="500dp"
        android:layout_height="580dp"
        android:layout_alignParentStart="true"
        android:layout_alignParentTop="true" />


    <Button
        android:id="@+id/picture"
        android:layout_width="75dp"
        android:layout_height="75dp"
        android:layout_gravity="center"
        android:background="@drawable/circle"
        android:layout_marginBottom="18dp"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true" />

</RelativeLayout>

尝试将其设置为与\u父级匹配,而不是500dp:

android:layout_width="match_parent"
android:layout_height="match_parent"

尝试将其设置为与\u父级匹配,而不是500dp:

android:layout_width="match_parent"
android:layout_height="match_parent"

您尝试过android:layout\u width=“match\u parent”而不是500dp吗?尝试使用from LinearLayout而不是RelativeLayout作为其根视图,并使用from android:layout\u weightSum测量两个子布局您尝试过android:layout\u width=“match\u parent”吗代替500dp?尝试使用from LinearLayout而不是RelativeLayout作为其根视图,并使用from android:layout\u weightSum来测量两个孩子的布局。它不起作用,我认为AutoFitTexture类为我的手机获取了错误的尺寸。它不起作用,我认为AutoFitTexture类为我的手机获取了错误的尺寸。
android:layout_width="match_parent"
android:layout_height="match_parent"