XML file code prompt
The adt also contains code prompts for xml files. To make the prompts more violent, we also need to set up
Open eclipse-Window-Preferences and switch to XML-XML Files-Editor-Content Assist in the directory tree on the right.
The next step is simple. The latency is set to 50 ms, prompting you to enter all the letters that can be filled in. You can try it after the settings are complete. Enter the id. The Code prompts android: id directly. Press enter to enter the id, and the cursor is positioned in double quotation marks.
Powerful Ctrl + 1
Press Ctrl + 1 on the Code and you may receive unexpected results.
For example, for the following error, there is an error with no id and a warning. test is not written to string. xml.
Press Ctrl + 1 in the error area. In the prompt box that appears, select Create resource @ id/TV _test. The id is automatically added.
Similarly, press Ctrl + 1 in the warning area, select the first item in the pop-up box, and enter the name you want to start. create an option in xml with "test" as the content
Color can also be added using this method
If no error occurs, use Ctrl + 1 on an xml node.
Wrap in Container wraps the current node into another node, for example, adding a Layout to the TextView field.
Remove Container removes the parent node of the current node, for example, Layout outside TextView.
Change Widget Type: Modify the Type of the current node. The target is a widget, such as TextView.
Change Layout Type: Modify the Type of the current node. The target is Layout.
The Extract as Include statement changes the current node to an include statement, which extracts the content of the current node into another new xml file.
Extract Style extracts the attributes of the current node and replaces them with a style. This is very useful because it cannot completely Extract the attributes, but it also saves the trouble of creating a new style.
Rename is not explained. Rename is equivalent to ctrl + shif + r.
Surround with new element enclose the current node with a new node.
Automatically generate code
Corresponds to the function that inherits the word parent class. Take Activity as an example. to generate the onStart and onPause functions, click the source-override/Implement Methods menu...
Select the corresponding function. You can select the function or variable to generate the code. Click OK to generate the code.
You can also Generate the set and get functions of member variables by using Generate Getters and Setters, or directly input get or set to wait for the code prompt.
Add source code for support-V4
Android-support-v4.jar.properties
File, enter src = C :\\ Android \ sdk \ extras \ android \ support \ v4 \ src
C: \ Android \ sdk \ extras \ android \ support \ v4 \ src is the source code folder. If you want to keep the source code with you, you can pack it into a project directory,
Jar cvf-C.
Android-support-v4-src.jar is the registration to generate, src is the source directory
After packaging
Src =./android-support-v4-src.jar,
Restart eclipse to see the source code.
Create packages, classes, android xml files, and code scans (which defined strings in string. xml are not used, and so on can be scanned. The specific functions are not familiar yet ),
These shortcut buttons are much easier to use than right-click buttons.