Android手势识别 Camera 预览界面上显示文字 布局注意事项(merge布局)
来源:互联网 发布:mysql where 编辑:程序博客网 时间:2024/06/05 11:00
通常在Surfaceview作为预览视频帧的载体,有时需在上面显示提示文字。以前我弄的都好好的,今天忽然发现叠加的TextView不管咋弄都出不来文字了,跟Surfaceview一起放在FrameLayout也不行,后来想到merge布局,发现也不行。大爷的,奇了怪了,最后发现了原因,原来是顺序问题。也即无论是在RelativeLayout里还是merge布局里,View是逐个叠加上去的,一层一层铺上去的。如果你先放TextView在最前面,那肯定被后面的全屏Surfaceview覆盖了。用常规的RelativeLayout或者merge,只要处理好这个顺序问题都可以实现效果。下面附上本文的布局:
- <span style="font-family:Comic Sans MS;font-size:18px;"><merge 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"
- tools:context=".CameraActivity" >
- <FrameLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content" >
- <SurfaceView
- android:id="@+id/previewSV"
- android:layout_width="0dip"
- android:layout_height="0dip" />
- </FrameLayout>
- <TextView
- android:id="@+id/tv_info"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="开始检测..."
- android:textColor="@android:color/holo_blue_light"
- android:textSize="25sp"
- android:visibility="visible" />
- <org.yanzi.ui.HandView
- android:id="@+id/hand_view"
- android:layout_width="match_parent"
- android:layout_height="match_parent" />
- <ImageButton
- android:id="@+id/photoImgBtn"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="bottom|center_horizontal"
- android:background="@drawable/photo_img_btn" />
- </merge></span>
传两张效果图:
张开手,红色画框:
手指合拢,画蓝框:
0 0
- Android手势识别 Camera 预览界面上显示文字 布局注意事项(merge布局)
- Android手势识别 Camera 预览界面上显示文字 布局注意事项(merge布局)
- Android界面布局文字水印
- 上拉下滑手势显示隐藏布局
- Android Studio预览布局时显示ActionBarOverlayLayout
- android camera 布局分析
- android布局属性预览
- android布局属性预览
- android布局属性预览
- android布局属性预览
- android布局属性预览
- Android studio design界面的布局文件无法预览
- android之merge布局
- android之merge布局
- android之merge布局
- android之merge布局
- android之merge布局
- android之merge布局
- 位运算的妙用
- CoreData用法一:增删改查(Demo讲解)
- ubuntu 12.04 使用 tp-link 821n 连接 无线问题
- 2014-5-25
- Win7 自带FTP服务器搭建
- Android手势识别 Camera 预览界面上显示文字 布局注意事项(merge布局)
- 如何调整eclipse字体大小
- SQL 优化原则
- 【C++多线程编程】Boost线程库
- Oracle游标的使用
- LeetCode: Unique Paths [061]
- 程序员应该如何学习英语?
- mhook钩ZwProtectVirtualMemory直接崩溃的问题与解决
- 使用Gradle构建Android项目