Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/opencv/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/asp.net-mvc-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Javacameraview与边界布局的全宽相同_Android_Opencv_Javacameraview - Fatal编程技术网

Android Javacameraview与边界布局的全宽相同

Android Javacameraview与边界布局的全宽相同,android,opencv,javacameraview,Android,Opencv,Javacameraview,Im使用以下代码在布局中显示摄影机视图 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:opencv="http://schemas.android.com/apk/res-auto"

Im使用以下代码在布局中显示摄影机视图

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:opencv="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:keepScreenOn="true"
    android:orientation="vertical"
    android:weightSum="2">

    <RelativeLayout
        android:id="@+id/cam_frame"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@color/colorPrimary">

        </LinearLayout>

        <org.opencv.android.JavaCameraView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:visibility="visible"
            android:id="@+id/AddPersonPreview"
            opencv:show_fps="false"
            opencv:camera_id="any" />

    </RelativeLayout>


    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="0dp"
        android:background="@color/colorPrimary"
        android:layout_weight="0">

    </LinearLayout>

</LinearLayout>

我正试图让摄像头视图占据与
摄像头框架
相同的全宽和全高。它占据了高度,但框架的宽度没有完全占据,因此在宽度旁边有一个黑色背景。我怎样才能解决这个问题?


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:opencv="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:keepScreenOn="true"
android:orientation="vertical">

<RelativeLayout
    android:id="@+id/cam_frame"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/colorPrimary">

    </LinearLayout>

    <org.opencv.android.JavaCameraView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="visible"
        android:layout_margin="30dp"
        android:id="@+id/AddPersonPreview"
        opencv:show_fps="false"
        opencv:camera_id="any" />

</RelativeLayout>

</LinearLayout>


我希望相机只占据屏幕的一部分,您可以使用边距。我只需在
JavaCameraView
中添加边距属性。但很难理解你的布局。你可以发布usi的设计吗?我希望相机只占据屏幕的一部分,你可以使用边距。我只是在
JavaCameraView
中添加了一个边距属性。但很难理解你的布局。你能帮我们把设计贴出来吗