1.在camera视图中显示其它控件,在增强现实中有很重要的应用,下面介绍一种在camera视图中加载其它控件的方法。
2.下面先来展示下要达到的效果,如下图中所示

3.首先要是在一般的容器来,像linearlayout,relativeLayout,tableLayout,FrameLayout等可以在代码中动态布局,但在摄像头视图下,本人用的是textureView怎么都不可以添加相关的控件,比如加个editText或是button等,特别是上图想要的效果,基本达不到。
4.首先出现上图所示的关键不是代码而是布局文件,产生上面视图和布局文件如下所示
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mainView"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextureView
android:id="@+id/texture"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
/>
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="dragon test"
android:textColor="@android:color/holo_green_light"