1. Use linear layout (linearlayout) and relative layout (relativelayout) As far as possible, do not use absolute layout.
2. Use dip and SP as far as possible, do not use PX.
3. Provide different layout files and pictures for different
Copy Code code as follows:
Hide IME
Inputmethodmanager IMM = (Inputmethodmanager) getapplicationcontext (). Getsystemservice (Context.input_method_ SERVICE);
Show or hide IME
Imm.togglesoftinput (0, inputmethodmanager.hide_not_always);
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
The creation of a menu item has already been discussed in an article, but it is less efficient and difficult to maintain, and now implements another way to create menus.
Menuinflater, this class allows us to easily create menu items, as follows:
1,
@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
Looked up a lot of information, is returned is incomplete, simply tidy it, at least to ensure that in my practice correct, lest mislead the reader, but also to make a record for themselves!
Brief introduction
Android offers three menu types,
In the development process found that some software for Chinese path support is not good, if the use of Uri.fromfile to convert Chinese path to the URI, some software may not be recognized to cause abnormal function, known to have two applications: 1
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:
1 View Toggle Control-viewflipper Introduction
The Viewfilpper class inherits from the Viewanimator class. And the Viewanimator class inherits from Framelayout.
Looking at the source of the Viewanimator class, you can see that this kind of
Special attention is given to the use of jar packages and resource bundles for third-party developers, and in our engineering code, we can't reference resources in the same way as R.layout.main, R.string.name, and so on.
To do this, we can not
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
The strategy model is actually very simple (to hear this sentence, people are not in the heart suddenly relaxed? )。For example, the official tells everyone I have here a sort of interface isort the sort () method, and then the folk do their best to
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