In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
Editor to share with you how to set up Android Studio, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
1. Code reusability. FindviewById,onclick event, repeating such boring code over and over again is a waste of life. This problem is recommended to be solved through dependency injection framework ButterKnife, which directly generates all the controls in the layout with one click, including onclick click events, but such as the controls in the row layout item, and the layout of include reuse in the layout how to use the framework to solve, this remains to be seen later. Another area with a high code repetition rate is the handling of HTTP callbacks. When interacting with the server, it is inevitable to parse the returned json data and deal with it accordingly according to the status in different states. By encapsulating the callback listener listener, part of the duplicated code can be reduced.
two。 Code reusability. When using github to use some of the god's open source libraries, you will find that eclipse is becoming more and more marginalized. With reference to the article on the percentage layout of my blog, android studio users can easily integrate many tool classes / libraries by adding a line of code in gradle. Eclipse users can only copy the relevant java classes and files by themselves, do a demo test first, and then integrate them into the project, which is time-consuming and laborious. Therefore, in order to solve this problem, it is necessary to learn android studio. For the time being, I have little knowledge about the use of android studio, but it takes me a lot of energy to solve some problems, so even some simple knowledge can help friends who also encounter these problems.
So let's start with the text. First of all, the first step of getting started with android studio: # # installation of android studio: there is no need to teach the installation process of domestic image address. After it is installed, some people may encounter the click program and flash and can't open it. Solution: modify the configuration file: Android-Studio\ android-studio\ bin\ idea.properties, and add: disable.android.first.run=true at the end of the file
In the first part of the tutorial, set up some parameters first. If you want to do a good job, you must first sharpen its tools. # # basic settings to enter settings are as follows: (1) launch interface: Configure-settings, (2) File-settings, (3) Click the icon on the top toolbar
Partial configuration setting method:
1. The setting of the theme, Darcula is the legendary black theme of geek style.
Font setting, search font in the search bar, modify it directly, and preview it in real time below. It is recommended to click save as to save a copy after modification.
Display the line number to facilitate the subsequent positioning of the bug location according to the error log
Here comes the big story, shortcut key style setting, but even if you directly set eclipse, there will still be some shortcut key conflicts, which will be mentioned below
Associate keyboard shortcuts. When there was a conflict, I chose to ignore the conflict and change it to the same alt+/, as eclipse. After all, this is too common.
Sets the association to be case-insensitive. However, when editing in the xml interface, for example, to enter
Coding
Some friends want to enter the project directly as soon as they open as, skip the startup interface of selecting project, and uncheck reopen lase project.
Code area background color setting
Android studio is different from eclipse. After eclipse associates a method, the method contains the parameters of the method by default. We just need to modify it. After studio associates the method, the parentheses are empty. But there will be a floating box prompt:
This suspension window will greatly facilitate our writing of the method. The corresponding parameters are modified as follows: 10.1: the time when the suspension window appears after modifying the method.
10.2: if you finish writing the method, move it somewhere else and move back, forgetting the parameters needed in the method, there are two ways: 1, when you place the mouse over the method name, there will be an introduction to the method. 2, use the shortcut keys to display the floating window in the image above, and the shortcut key modification method: (I changed it to alt+. This shortcut is also conflicting, but nothing wrong has been found for the time being
There is also a commonly used shortcut key ctrl+1 in eclipse. For example, when we new a class, new A (), press ctrl+1, and automatically associate it to An a = new A (). In studio, we also need to set the following:
Modify the default comment information. Comment information that is added at the top of the file each time you create a new java file.
# # shortcuts here are some shortcuts different from eclipse in android studio: insert blank lines up: ctrl+ space error prompt: alt+ enter generation construction method, set and get, etc.: alt+ insert local variables become global variables: ctrl+alt+ F extraction method: shift+ alt+ M resource file renaming: where is the alt+shift+R view method used: ctrl+G clear invalid package: ctrl+alt+o
Continue to complete in the course of other subsequent use. To modify the relevant shortcut key, just click on any one of the shortcut keys in keymap and change it to the original key. For example, error prompt alt + enter using not used to want to change the key, but do not know the location of the error prompt key, this is as long as any one of the keymap modified into alt + enter, the prompt box will prompt this key combination and which function conflicts, according to the scarlet letter prompt to find the location, the location is the location of the function you want to modify. This is the basic setting for android studio. Stay hungry, Stay foolish .
The above is all the content of this article "how to set up Android Studio". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.