Precautions for displaying text layout on the Android Gesture Recognition Camera preview interface (merge layout)

Source: Internet
Author: User

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 = "" xmlns: 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:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.