In the activity, overwrite the following two methods:
Copy Code code as follows:
Create a Menu
@Override
public boolean
oncreateoptionsmenu(Menu menu) {
Menu.add (0, 0, 0, "about");
Menu.add (int groupId, int itemId, int
Now we surf the internet will use Baidu or Google search information, when we enter one or two words in the input box, we will automatically prompt the information we want, this effect on Android is through the Android The Autocompletetextview
Android drop-down menu, such as in HTML, the key is to call the Setdropdownviewresource method, in XML to define the appearance of the Drop-down menu to display
Steps:
1. Define spinner control
Copy Code code as follows:
Android:id=
There is a need, we click on the menu item to exit the application, the application will exit, do not need to go back to mainactivityDesign:There are two application interfaces mainactivity and bactivity, and common classes for programs Exitutil
Service Concept and use:
Android services, it is different from the activity, it can not interact with the user, can not start their own, running in the background of the program, if we quit the application, the service process is not over, it is
@drawable/icon@: On behalf of R.javaDrawable: Inner class drawableIcon:id is the object of iconConstant of the value in the drawable inner class in the R.java file that has the ID icon
Android:label= "title of Window">Represents the configuration
Android uses Asynctask to listen for asynchronous loaded actions
The use of Asynctask has many examples on the internet and is very convenient to use. Here is not detailed the use of specific methods, students can Google a bit, a lot.
Scene
Products in the test process found a bug, is the tester constantly crazy click on a button, triggered the toast, toast content will always line up the display, not quickly disappear. This may affect the user's use.
See Toast has a Cancel () method:
In general, many controls are used on this page, and the control uses a lot of resources. The Android system itself has a lot of resources, including a variety of strings, pictures, animations, styles, layouts, and so on, which can be used directly
Recently to do a small function encountered such a problem, ListView and Baseadapter in combination, about the point of praise when the picture repeats, such as: I in the 1th item point of Praise and then heart-type replaced by red, but later every
Objective
There are many ways to implement caching, skills and pits are many, today I give you some of the unconventional methods, you can skillfully help you realize some memory cache.
Supplier and Memoize
SQLite is a commonly used form of data
Now a lot of apps will appear Android to achieve the rotation around the center of the Guide page effect, a similar car has been moving forward on the Rotary animation effect.
First look at the preview effect:
Well, the overall effect is also
First look at the effect map (the recorded GIF a bit card, the real effect is still very smooth)
Realize the idea
The above GIF can draw a conclusion, in fact, it is to draw two text information at the same time, and then through the animation
TextView is a control used to display text labels.
Copy Code code as follows:
/*textview set *//* Get TextView Object * *
TextView = (TextView) This.findviewbyid (R.id.textview);
String string = "TextView Sample!" ";
/* Set
Android ViewPage implementation to prevent sliding
Since the recent project has an Android ViewPage to achieve the prohibition of sliding such a function, began to feel very difficult to achieve, but the project manager assigned tasks, customer
This article is an example of how the Android program implements the file browsing function. Share to everyone for your reference, specific as follows:
Recently uploading files, at that time, how can realize the function of FileDialog, open the
Android provides a invalidate method for interface refreshes, but invalidate cannot be invoked directly on the thread because he violates the Single-threaded model: Android UI operations are not thread-safe and must be invoked in the UI thread.
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