Divide by zero error occurs when you set ImageView to a fixed size when displaying a picture in TablelayoutChange Layoutparams to Tablerow.layoutparamsTablerow.layoutparams params = new Tablerow.layoutparams,//50 x 50TableRow row = new TableRow (activity);ImageView Imgview = new ImageView (activity);Imgview.setlayoutparams (params);Imageloader.displayimage (FileName, Imgview, options);//Display pictureRow.addview (Imgview);Vh.imgLayout.addView (row);mark~And
The steps are as follows:1. The angle at which the picture file is rotated is read first:/** * Read the rotation angle of the picture file through the Exifinterface class * @param path: path to the picture file * @return The image file's rotated angle */public static int readpicdegree (String p ATH) {int degree = 0;//reads the picture file information class Exifinterfaceexifinterface Exif = null;try {exif = new exifinterface (path);} catch (Ioex Ception e) {//TODO auto-generated catch Blocke.pri
Android controls layout ToggleButton pictures and text,
The ToggleButton control has the checked attribute, which is very useful for functional buttons to switch the status.
Here, we use the phone's button to enable DTMFTwelveKeyDialer to show its effect and layout.
Activity_main.xml
DrawableTop references icon_keyboard_bg.xml.
Icon_keyboard_bg.xml
In this way, three images in different states can be swi
There's a detailed explanation in the code, and I'm not going to say much.1 //process and save images2 PrivateFile Dealphoto (Bitmap photo) {3FileOutputStream FileOutputStream =NULL;4 //name of the picture, time named5SimpleDateFormat format =NewSimpleDateFormat ("Yyyymmddhhmmss");//Time Format6Date Date =NewDate (System.currenttimemillis ());//Current Time7String photoname = Format.format (date);//format name8 //Image Storage Address9File Savedir = environment.getexternalsto
GIF-enabled ImageView, using the open source framework on GitHub, project address https://github.com/koral--/android-gif-drawableIf GIF is a network image, this library does not support loading a URL directly, but provides a gifdrawable class that can create gifdrawable through files, input streams, and so on .So you can download it first or get the input stream by creating a drawable load. The following examples illustrate two methods:1. Download to
The effect is to click the button, open the System library application, you can choose a picture inside the show outSet an implicit intentGet Intent object, come out with newCall the setaction () method of the Intent Object , set the action, parameter:intent.action_pickCall the SetType () method of the Intent Object , set the type, parameter:"image/*" can also get videoCall the Startactivityforresult () method to turn on the return value of theView the system's gallery Source code can know, ret
Android Pictures capture character portraits (like funny photos ),Requirements
Captures the resource map based on the given header template. Supports drag, zoom, and drag rotation for the background image.
Analysis
Defines the cut float layer to implement the operation view of the background resource map.Implementation
Draw cut float Layer
/*** Initialize the painting pen */private void initRectPaint ()
Android imitation photo, second shot, video cover selection. There are pictures with truth.
I am too lazy to add comments when there are not many codes. Forgive me for being lazy.
No thread is added for obtaining the thumbnail. FC may occur on some low-end servers or HD videos. You need to add the required children's shoes.
Code:
package com.tan.videoselectthumbnail;import java.lang.ref.WeakReference;im
1, first create a bitmap picture, and specify the size;2. Create a new canvas on the picture, then draw it on the canvas and save it;3, need to save the directory file, note if the write directory such as "/sdcard/song/" if not exist, you must first create (File.mkdirs).4, need to add permissions: Canvas is a canvas, you can create a blank canvas, just new one canvas object, no parameters required. You can also use Bitmapfactory to create a bitmap object, as a new canvas object parameter, that i
, int roundpixels)
{
//Create a bitmap of the same size as the original picture
Bitmap roundconcerimage = Bitmap.createbitmap (Bitmap.getwidth (),
Bitmap.getheight (), config.argb_8888);
//Create a canvas with bitmap roundconcerimage
Canvas canvas = new Canvas (roundconcerimage);
//Create brushes
Paint paint = new paint ();
//Create a rectangle of the same size as the original picture
Rect rect = new Rect (0, 0, Bitmap.getwidth (), Bitmap.getheight ());
RECT
1, first create a bitmap picture, and specify the size;2. Create a new canvas on the picture, then draw it on the canvas and save it;3, need to save the directory file, note if the write directory such as "/sdcard/song/" if not exist, you must first create (File.mkdirs).4, need to add permissions: Canvas is a canvas, you can create a blank canvas, just new one canvas object, no parameters required. You can also use Bitmapfactory to create a bitmap object, as a new canvas object parameter, that i
ScaleType keep the original size of the pictureScaletype= "Fitxy" fills the boxScaletype= "Fitstart" to maintain aspect ratio zoom in the upper-left cornerScaletype= "Fitcenter" maintains aspect ratio zoom in the centerScaletype= "Fitend" to maintain aspect ratio zoom in the lower-right cornerScaletype= "center" is not scaled in the centerScaletype= "Centercrop" keeps the aspect ratio zoom and place the picture completely covered ImagevieScaletype= "Centerinside" to maintain aspect ratio zoom an
In a previous company to do an app inside the upload avatar function, then studied for a long time, found an article about the H5 Camera and album calls, so it solved the problem!! I record here so that some people need, can refer to!!!!The following is a complete HTML page content, placed on the server and then browse on it, only support chrome and Safari core browser, QQ browser, Chrome,safari browser can be. Different phones and browsers do not show the same way.Web call
public class MemoryCache { private static final String TAG = "MemoryCache";Private mapNew linkedhashmapPrivate long size=0;//current Allocated sizePrivate long Limit=1000000;//max memory in bytes Public MemoryCache () {Use 25% of available heap sizeSetlimit (Runtime.getruntime (). MaxMemory ()/4);} public void Setlimit (long new_limit) {Limit=new_limit;LOG.I (TAG, "MemoryCache would use the up to" +limit/1024./1024.+ "MB");} Public Bitmap get (String ID) {try{if (!cache.containskey (ID))return n
Need to list the picture file of the specified directory, draw on the method of the Internet, find out that the list is all the files, so it is inconvenient to use, here also did not find a solution, through their own further research finally fix, send up to useful classmates.In the following way can implement query implementation query SD card A subdirectory of the picture file details:
Selection: Specifying query criteria
String Selection = mediastore. Images. Media. DATA + "like%?" ;
1. Select the icon to add to the cart from http://www.iconfont.cn/.2. Select the download code in the shopping cart.3. Open the compressed package and put the four files in the package into the Asstes folder in the project.4. Import the picture in the code by setting TextView typeface.1 TextView TestView = Findviewbyid (r.id.text); 2 Typeface Typeface = Typeface.createfromasset (Getassets (), "Iconfont.ttf"); 3 Testview.settypeface (typeface); 4 Testview.settext (html.fromhtml (" #xf0343;")); Te
Phenomenon
In Android development, it is often necessary to replace the picture in res\drawable, open the File Preview layout page under Res\layout to find that the image has been replaced, but in the simulator or the real machine run on the discovery that the picture has not been replaced, or use the original resource picture.
Reason
During the development process, a picture resource file (such as drawable-hdpi, drawable-ldpi, and DRAWABLE-MDPI) u
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.