Android OpenCV和顶部的文本视图

Android OpenCV和顶部的文本视图,android,opencv,surfaceview,Android,Opencv,Surfaceview,我正在尝试使用openCV进行这个Android项目。不是很复杂,而是手部检测和音乐播放器。 我确实对Android有基本的了解,但我对一些专门使用Surface holder和View的东西感到困惑。 我们使用“openCV样本-人脸检测”启动了该项目。。 首先,我想把图像/文本视图放在摄像头提要的顶部。我确实在这方面看到了很多线程,但我不确定现有的代码是否有很大的不同;不确定是否使用“曲面视图”。 因此,我在XML中将其更改为相对布局,而不是线性布局。我得到的一个错误是“按钮不能充气错误”

我正在尝试使用openCV进行这个Android项目。不是很复杂,而是手部检测和音乐播放器。 我确实对Android有基本的了解,但我对一些专门使用Surface holder和View的东西感到困惑。 我们使用“openCV样本-人脸检测”启动了该项目。。 首先,我想把图像/文本视图放在摄像头提要的顶部。我确实在这方面看到了很多线程,但我不确定现有的代码是否有很大的不同;不确定是否使用“曲面视图”。 因此,我在XML中将其更改为相对布局,而不是线性布局。我得到的一个错误是“按钮不能充气错误” 这是我的XML-

<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" >

    <org.opencv.android.JavaCameraView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:id="@+id/image_manipulations_activity_surface_view" />

    <Button 
        android:id="@+id/button1"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="105dp"
        android:text="Press mee"
        android:layout_below="@+id/image_manipulations_activity_surface_view"
         />

    <TextView
        android:id="@+id/txtDisp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/button1"
        android:layout_alignBottom="@+id/button1"
        android:layout_marginLeft="25dp"
        android:layout_toRightOf="@+id/button1"
        android:text="@string/app_name"
        android:textAppearance="?android:attr/textAppearanceLarge" />

</RelativeLayout>
我的OnCreateWITH错误如下所示:

 public void onCreate(Bundle savedInstanceState) {
        Log.i(TAG, "called onCreate");
        super.onCreate(savedInstanceState);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

        setContentView(R.layout.image_manipulations_surface_view);

        mOpenCvCameraView = (CameraBridgeViewBase) findViewById(R.id.image_manipulations_activity_surface_view);
        mOpenCvCameraView.setCvCameraViewListener(this);
        //GET REFERENCEE
        mediaPlayer = MediaPlayer.create(this, R.raw.groovy);
        //display current volume
   //     final Button button  = (Button) findViewById(id.button1);

      //  public boolean onTouch
        mOpenCvCameraView.setVisibility(SurfaceView.VISIBLE);
      //  View

        ArrayList<View> views = new ArrayList<View>();
        views.add(findViewById(R.id.button1));
        views.add(findViewById(R.id.txtDisp));
        mOpenCvCameraView.addTouchables(views);

        SurfaceView surfaceView = (SurfaceView) findViewById(R.id.image_manipulations_activity_surface_view);
        mSurfaceHolder = surfaceView.getHolder();
        mSurfaceHolder.addCallback(mSurfaceHolderCallback);

    }