Android Watermark Camera

Source: Internet
Author: User

This article realizes the watermark camera, similar to QQ space in the watermark camera function, because has seen a demo on the implementation of a simple watermark camera function, it is very interesting, on this basis has been modified, optimized and perfected, and added a part of the function, so that it is closer to the QQ watermark camera function.

Support Features:

1. Rear-facing camera switch;

2. Focus on the camera and click on the screen to focus (if the phone supports the focus function);

3. The camera screen will be adjusted according to the resolution supported by the camera, without the picture stretching and deformation;

4. Support to modify the mood phrases in the watermark, etc.;

:







The watermark in fact is Viewpaper added n custom view, through the frame layout overlay on the Surfaceview, save the picture is actually equivalent to the screenshot, the main code is as follows:

View.setdrawingcacheenabled (True); View.builddrawingcache (); Bitmap Bitmap = View.getdrawingcache (); int width=view.getwidth (); int height=view.getheight (); Bitmap B = Bitmap.createbitmap (Bitmap, 0, 0, width, height); View.destroydrawingcache ();
View is the parent control that displays the picture position in the activity after the photo is taken:

    <relativelayout        android:id= "@+id/rl_water"        android:layout_width= "match_parent"        android:layout_ height= "Wrap_content"        android:layout_above= "@id/ll_buttom"        android:layout_below= "@id/ll_title" >        <imageview            android:id= "@+id/water_photo"            android:layout_width= "Match_parent"            android: layout_height= "Match_parent"            android:contentdescription= "@string/app_name"            android:scaletype= " Centercrop "/>        <android.support.v4.view.viewpager            android:id=" @+id/viewpager "            android: Layout_width= "Match_parent"            android:layout_height= "wrap_content"            android:layout_alignparentbottom= " True "            android:layout_marginbottom=" 10DP "/>            </RelativeLayout>

As in this articlerelativelayout;

This article implements the custom mood text, other such as the city (can be achieved by positioning), name and so on can be implemented in a similar way, the people are interested can realize their own, if the project has similar needs, you can directly use into the project, of course, the adaptation of various models of the problem still need to consider!

Source Address: http://download.csdn.net/detail/baiyuliang2013/8492231


Android Watermark Camera

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: info-contact@alibabacloud.com 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.