[learn Android Studio Chinese course] Chapter Ii: Overview of Android Studio (i)
Source: Internet
Author: User
<span id="Label3"></p><p><p></p></p>[learn Android studio] Chapter ii: Android Studio Overview (i)<p><p></p></p><p><p>Android Studio is a windowing development environment. In order to make full use of the limited screen space, do not let you shackled,<br>Android Studio displays only a small subset of available windows at specific Times. In addition to some context-sensitive Windows and contextual windows that appear outside, the others remain hidden unless you actively open them. or, conversely, Some visible windows until you actively hide Them. To make the most of Android Studio, you need to understand the capabilities of these windows and how and when to display Them. In this chapter, we'll show you how to manage Windows for Android Studio.<br><br>The underlying function of any one integrated development environment (IDE) is Navigation. Android projects are usually made up of many packages, directories and files, and even a slightly more complex Android project can contain hundreds of of these Resources. The efficiency of your use of Android Studio is largely dependent on how comfortable you are with these Resources. In this chapter, we'll also show you how to use navigation in Android Studio.<br><br>finally, we'll Show you how to use the Help system in Android Studio. To fully understand this chapter, we open the HelloWorld project created in chapter ONE. If the project is already open in Android studio, you are ready to do so. Please refer to Figure 2-1, we will discuss the following navigation Functions.<br><br></p></p><p><p><br><em>Figure 2-1 Android Studio integrated development Environment</em><br><br></p></p>The editor<p><p>The primary purpose of any IDE is to edit the File. As expected, windows in Android Studio that allow users to edit files are located in the center of the Ide. In all the windows, the edit window is the only one that is always visible and is in the center of the WINDOW. In fact, the editing window is everywhere in Android studio, so from now on we call it an Editor. All other windows around the editor in Android Studio are called tool windows and side Windows (left, bottom, right).<br><br>The editor is a tabbed window similar to a modern web Browser. When you open a file from a tool window, keyboard shortcut, or context menu, the file is displayed as a tab in the Editor. And then your first new project--helloworld, Mainactivity.java and Activity_main.xml are automatically loaded as tabs in the Editor. Android Studio tries to speculate on what files you want to start editing, and then automatically opens as a tab in the editor when the New Project Wizard Finishes. Almost any file can be opened in the editor, although the original image and sound files are not yet editable in Android Studio. You can also drag files from the tool window to the editor, which can be opened directly as tabs in the Editor.<br><br>Above the editor is the Edit tab. On the left edge is the edge column, and the right edge is the formula bar. Let's start Exploring.<br><br></p></p>Editor Tabs edit tab<p><p>Switch tabs in Android studio using CTRL or ALT + left or right arrows. of course, You can also select the Edit tab with the Mouse. The options for the Editor tab are located under Window>editor tabs of the main menu bar. Any action you make here will be applied to the currently selected tab. Place your mouse on the Mainactivity.java tab and right-click it (ctrl + click on your mac). As shown in 2-2, in the generated menu you will see many of the same options as Window>editor tabs. From this menu, select the tabs placement submenu. This menu option allows you to move the tabs up, down, left, and Right. Moving a tab to the left or right holds more visible tabs, but it takes up a portion of the Screen.<br><br></p></p><p><p><br><em>Figure 2-2 Content menu Edit tab</em><br><br>The close and close all operations on the editor menu are clear. And you want to close all of the tabs besides, you should use close Others. The split vertically and split horizontally operations are used to divide the editor into Windows. If you want to compare two files then split vertically will be Useful. You can subdivide indefinitely, although the effect of this nesting is greatly reduced. You can also drag files from other Windows to any panel in the editor, or from one panel to another panel. When the last tab is closed, the entire panel disappears.<br><br></p></p>The Gutter side row<p><p>The side column is used to pass information about your Code. Perhaps the most obvious feature of the side column is that the visualization resources are displayed on the same line of your code with small color cards or small icons. Edge columns can also be used to set breakpoints, support code folding, and act as code-scoped Indicators. All of these features will be described in detail in subsequent Chapters.<br><br></p></p>The Marker bar marker bar<p><p>The right side of the editor is the marker bar. The marker bar is used to indicate the location of important rows in your resource File. For example, when your Java or XML file has a warning message or a compilation error, the marker bar highlights the Information. The right column also displays uncommitted changes, the results of the search, and the location of the Bookmark. The tab bar does not scroll like an edge column, instead, the color tag on the tab bar is relative to the length of the File. Clicking on the color tag in the tab bar will immediately jump to the location of the File. Now practice using the tab bar by clicking on some colored Markers.<br><br></p></p>Tool Buttons Tools button<p><p>You should have seen the default display in the left panel of the project tool WINDOW. You can click View>tool Windows on the main menu to see all the tool windows. Now you can watch the Ide's left, right and bottom carefully. You will find the tool button corresponding to the WINDOW. Note that there are some tool buttons followed by a number that combines ALT (cmd on Mac) keys to open/close the corresponding tool window. Try tapping these tool buttons to practice this Skill. Use keyboard shortcuts at the same time alt+1| cmd+1,alt+2| cmd+2,alt+3| cmd+3, etc. opens/closes the tool window.<br><br>When a tool window is open, the corresponding tool button is dark gray, indicating that it cannot be pressed. Notice the tool button at the corner of the Edge. For example, The default location for project is in the Upper-left corner, and the default location for favorites is in the Lower-left corner.<br><br>The sidebar (left, bottom, right) can be shared by two tool windows at the same Time. Also open the Favotites and project tools windows to see how the sidebar is Shared. As you can see, the Favorites and Project tool windows are located in the opposite corner of the same side. Two tool windows in the same corner will not appear in a side pane window at the same time. For example, project and Structure tool Windows cannot be displayed at the same time-at least not on the default configuration of Android Studio.<br><br></p></p>Default layout defaults<p><p>Don't confuse the default layout in Android Studio with the layout in the Android Sdk. The default layout is a specific set of tool windows that are clustered around the Editor. Android Studio opens and configures a default layout that displays the Project tool window on the left. The previous layout is shown in 2-1.<br><br>Let's take a look at the Window menu on the main menu. Top two menu items are Store<br>Current layout as default (which is stored as the default Layout) and restore default layout (restores the defaults). Restoring the default layout is usually used in the IDE window to become crowded, or you want to clean up the panel to restore it to your familiar Layout. You can also set a new default layout by opening, closing, Adjusting or repositioning your favorite windows, and then choosing to save the current layout as the default Layout.<br><br>—————————————————————————————————————————————————<br>Repositioning tool BUTTONS reposition Tools button<br><br>As mentioned earlier, the Project and Structure tool windows cannot be displayed at the same time because their corresponding tool buttons are in the same corner. But you can move the tool button to the corner you Want. Drag the Structure tool button to the corner in the lower left Corner. now, Use the keyboard shortcut alt+1| Cmd+1 and alt+7| | Cmd+7 or click the Tools button to open the Project and Structure tool windows. As we move the two tool buttons to the opposite corner, all project and structure can be displayed simultaneously in the same panel WINDOW.<br>—————————————————————————————————————————————————<br><br></p></p>Navigation tool windows Navigation Tools window<p><p>This section discusses the tool windows that are specifically used for navigation: Project,structure,favorites,todo and Commander. Table 2-1 lists the features of each of their navigation windows. The following chapters will discuss many other tool windows.<br></p></p><p><p><em>Table 2-1 Navigation tool windows</em></p></p><p><p><br><br></p></p>The Project tool window<p><p>We found that the Project tool window is a useful navigation tool window because it combines a limited width space with relatively easy access. To appreciate the utility of the Project tool window, you will set project to windowed Mode. Project has a total of three modes; project,packages and Android. Android Studio sets the mode to Android by Default. Android and Project are very useful modes, even though Android mode may hide some directories for you. The Mode settings combo box is adjacent to the Upper-left corner of the IDE Project button and is at a 90-degree angle. The Project Tools window provides a simple nested interface file and directory tree to facilitate your switchover. The Project Tools window renders an overview of all the packages, directories, and files in your Project. If you right-click in the Project Tools window (ctrl-clicking under mac), A context menu will appear. Here are three important menu items: copy path, file path, and display in Explorer. Click Copy Path to copy the absolute path of the operating system to the Clipboard. Click File path to display the directory stack in reverse order, and clicking on any of the directories will open them in the operating System. Clicking Show in Explorer will open a new window in your operating system to display the File. 2-3.<br><br></p></p><p><p><br><em>Figure 2-3 Project Tools window</em><br><br></p></p>The Structure tool window<p><p>The Structure tool window is used to display the hierarchy of elements in a file. When the editor displays Java source files such as mainactivity.java, the Structure tool window renders elements, such as fields, methods, and inner classes, in a tree shape. When the editor displays an XML file such as activity_main.xml, the Structure Tool window presents the XML element in a tree Structure. Click any element in the Structure tool window and the cursor will immediately move to that element in the Editor. The Structure tool window is ideal for navigating elements in large source Files. Practice this technique by opening the Structure tool window and navigating Mainactivity.java with elements in Activity_main.xml. As shown in 2-4.<br><br></p></p><p><p><br><em></em> <em>Figure 2-4 Structure Tool window</em><br><br></p></p>The Favorites tool window<p>When developing a feature (or debugging a bug) in android, you may create or modify some related files. A medium-complexity Android project may contain hundreds of individual files, so the ability to group related files is very useful. The Favorites Tool window is a favorite for logically grouping related files that you will actually be in a completely different place in your Project.<br><br>Open the Mainactivity.java and activity_main.xml files in the Editor tab. On either tab, right-click (ctrl-click under Mac) and select Add all to Favorites in the context Menu. Enter main in the input new Favorites list name and click OK. If the Favorites tool window is not open, the alt+2| cmd+2 to open it. Expand Main in the list, and then double-click to Open/activate one of the Files.<br><br>Just like the Favorites window allows you to immediately navigate to a specific file or filegroup, bookmarks allow you to quickly navigate to a specific line of a file. Place your cursor on any line of Mainactivity.java. Click F11 (mac Press F3). This operation is to create or delete the resource file including the bookmark in the XML file. Observe the check mark of the Edge column and the black mark of the marker bar to indicate the new label. View the bookmark you just created by opening the bookmark in the Favorites tool window.<br><br>Note: on a pc, if F11 is not responding, make sure that the F-lock key on your keyboard is Active.<br><br><em><em>< translator Note: Android Studio has been upgrading, here F11 no effect of Children's shoes can be viewed by clicking on the menu bar Navigate? Bookmarks to see the label shortcut keys. ></em></em><br><br>Breakpoints are used for debugging. Unlike tags, which can be set in any file, breakpoints can only be set in a Java file. Open mainactivity.java, and then click on the Edge column of the following line of Code:<br><br><code><code>setContentView(R.layout.activity_main);<br></code></code><br>you'll find a red circle appear in the Edge column, and the entire line of code is highlighted in Red. Breakpoints can only be set on executable lines of code; for example, if you set a breakpoint on a comment line, it has no effect. Open the breakpoints in the Favorites tool window to see the breakpoint you just Created. You can do a lot of interesting things with breakpoints, and in the 12th chapter, we'll discuss breakpoints for Debugging.<br><br></p>The Todo tool window Todo tools windows<p><p>TODO means, of course, the thing to do. TODO is essentially used by programmers and their collaborators to show what else to do. Todo is written like a comment, starting with a double slash, then Todo uppercase, followed by a space. For example:<code>//TODO inflate the layout here.<br></code><br>Create a Todo in Mainactivity.java and open the Todo tool window to see it. Clicking on a todo in the Todo tool window immediately jumps to Todo in the source Code.<br><br></p></p>The Commander tool window Commander tools windows<p><p>The Commander tool window is the navigation of the left and right Panes. These panes function like the Project and Structure tool windows. The Commander window differs from other navigation windows in that it displays only one directory hierarchy in a time period, rather than a directory Tree. If you prefer Window-style navigation or if you think the Project tool window is too cumbersome, then the Commander tool window may be a good navigation option.<br><br>< translator Note: This book has been published earlier, so some of the features of Android studio have been changed, such as commander has disappeared in the new version, so you can refer to children's shoes as Appropriate. ></p></p><p><p>[learn Android Studio Chinese course] Chapter Ii: Overview of Android Studio (i)</p></p></span>
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