Surfaceview is usually used as a carrier to Preview Video Frames. Sometimes a prompt text is displayed on it. I used to make a good job. Today, I suddenly found that the superimposed TextView was written in plain text, and it would not work if I put it in FrameLayout together with Surfaceview. Later I thought of merge layout and found that it would not work either. Uncle, it was a strange thing, and finally found the cause. It turned out to be a sequential problem. That is to say, whether in RelativeLayout or merge layout, views are stacked one by one and laid one by one. If you put TextView at the beginning, it will be overwritten by the full screen Surfaceview at the end. With regular RelativeLayout or merge, you can achieve the results if you have handled this sequence. The layout of this article is attached below:
<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 = "Start detection... "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>
Upload two images:
Open your hand and draw a red frame:
Close your fingers and draw a blue box: