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