In Android development, the methods, classes, or interfaces that make you brief encounter

Source: Internet
Author: User

Source: Liukun (@TheFresher)

PS: This article is based on my knowledge of the Android development, what makes you feel Brief Encounter method, class or interface? The answer to this question is summed up at this point, and if there is any new discovery, add it at any time. Happy Kinky.

    • GetParent (). Requestdisallowintercepttouchevent (true); deprive the parent view of the right to handle touch events, who knows who.
    • Argbevaluator.evaluate (float fraction, object Startvalue, Object Endvalue); Used to generate a new color based on a starting color value and an end color value and an offset, which is implemented in minutes like the bottom bar sliding color gradient.
    • API for Cliprect, Clippath, and clipregion clipping regions in canvas.
    • Bitmap.extractalpha (); Returns the alpha value of a new bitmap,capture original picture. Sometimes we need to dynamically modify the background image of an element and do not want to use more than one picture, through this method, combined with canvas and paint can dynamically modify a solid color bitmap color.
    • Handlerthread, instead of the repetitive physical notation of the thread of the new thread.
    • Intentservice, a service that can do his own job and not need us to manage the child threads.
    • palette,5.0 added can extract a bitmap in the prominent color of the class, combined with the above Bitmap.extractalpha, you understand.
    • Executors. Newsinglethreadexecutor (); This is Java, before you know it, it took a lot of effort to study the single-threaded sequential execution of the task queue.
    • Android:animatelayoutchanges= "true", the way to add view animations in LinearLayout, supports custom animations through Setlayouttransition ().
    • Viewdraghelper, customizing a sub-view to drag and drop ViewGroup, it's tiring to handle all sorts of things, huh? What the fuck!!
    • Gradientdrawable, before taking over the company's project, found a shadow effect is also good, thought is cut the picture, a look at the code, what ghost = =!
    • Asyncqueryhandler, if you do the development of system tools, such as contact SMS AIDS, and so on, must inevitably and contentprovider deal with, if the amount of data is not very large case, casually engage, if the volume of data is large, it is necessary to understand this class, It is important to note that this thing eats abnormally.
    • Viewflipper, enables multiple view switching (looping), customizable animation effects, and specifies animations for individual transitions.
    • A friend mentioned that there are some methods in the custom view when the hardware acceleration is not effective, after API16 there are many methods do not support hardware acceleration, usually we turn off hardware acceleration is in the manifest file, In fact, Android also provides a way to turn off hardware acceleration for a particular View, calling View.setlayertype (View.layer_type_software, NULL);
    • The pair class in the Android Util package can be conveniently used to store a "group" of data. Note that it is not key value.
    • Pointf,graphics a class in the package, we often see that when dealing with touch events, define a downx, a downy to store a coordinate, if the coordinates are not good, if you want to record too much of the coordinates of the code is bad to see. Using pointf (float x, float y) to describe a coordinate point is much clearer.
    • Statelistdrawable, the usual way to define selector is an XML file, but sometimes our image resources may be dynamically retrieved from the server, such as many apps so-called skins, which can only be statelistdrawable
      To complete, a variety of addstate can be.
    • In addition to setting focusable for the corresponding element when the item click event is not responding, the Android:descendantfocusability,listview item in the checkbox and other elements grab focus More simply, add android:descendantfocusability= "Blocksdescendants" to the item root layout
    • Android:duplicateparentstate= "true" to let the child view follow the state of its parent, such as pressed. A common usage scenario is when a button is small, and we want to expand the area of the click to give it a layer of layout, write the Click event to the parent, and if you want the selector of the click Effect of the Parcel button to continue to take effect, This is where Duplicateparentstate comes in handy.
    • Includefontpadding= "false", textview default up and down is a certain padding, sometimes we may not need to leave the upper and lower part of the white, plus it can.
    • Messenger, the interview usually will be asked to communicate between the process, under normal circumstances everyone is beginning to endorse, Aidl Balabala. One day on the blog of Hung god see this, well, as he said, can also be installed.
    • Textview.seterror (); Used to validate user input.
    • Viewconfiguration.getscaledtouchslop (); The minimum distance to trigger a move event, when customizing the View processing touch event, sometimes it is necessary to determine whether the user really exists in the movie, the system provides such a method.
    • Valueanimator.reverse (); Smooth cancellation of animation effects.
    • Viewstub, sometimes a region needs to show a different layout according to the situation, usually we will show and hide the different layouts by setvisibility method, but this is all loaded by default, with Viewstub to better improve performance.
    • Ontrimmemory, overriding this method in activity, will call back (support multiple levels) when memory is tight, so that we can proactively release resources and avoid oom.
    • Edittxt.setimeoptions, when using edittext pop-up soft keyboard, modify the display of the return key (always hate to use enter to interact with, so never know this thing)
    • Textview.setcompounddrawablepadding, the code is set TextView the drawable padding.
    • Imageswitcher, a class that can be used to make a picture switch, similar to a slideshow.
    • Weakhashmap, direct use of hashmap sometimes poses a risk of memory overflow, using Waekhashmap to instantiate a map. When the user no longer has an object reference, Weakhashmap will automatically be removed from the object that corresponds to the key value.
    • QQ Technology Group 290551701 http://cxy.liuzhihengseo.com/548.html

In Android development, the methods, classes, or interfaces that make you brief encounter

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.