Android Studio常用小技巧

简介: 1. Debug 模式查看变量的值;     To quickly evaluate the value of any expression while debugging the program, hold Alt and click this expression to see its val...

1. Debug 模式查看变量的值;

    To quickly evaluate the value of any expression while debugging the program, hold Alt and click this expression to see its value and calculate it, call a            method, etc.

   

 

2. 自动补全快捷键,默认,自己设置过快捷键以自己的为准:

   Use Basic Completion (Ctrl+空格) for completing words in text and comments in files of many different types.
   All the words from the current file that start with the typed prefix will appear in the lookup list.

 

  

 

3. 快捷键,查看参数信息,文档:

 

 The shortcuts such as Ctrl+Shift+空格 (View | Quick Documentation), Ctrl+P in default keymap (View | Parameter Info), F3 (Navigate | Declaration) and others can be used not only in the editor but in the code completion popup list as well.

 

 

When using Code Completion, you can accept the currently highlighted selection in the popup list with the period character (.), comma (,), semicolon (;), space and other characters.
The selected name is automatically entered in the editor followed by the entered character.

 

4。 查看最近的修改:

Use Alt+Shift+C in default keymap to quickly review your recent changes to the project.

 

 

5. 补全if , do while ,try catch 语句:

 

Use Ctrl+Shift+Enter to complete a current statement such as if, do-while, try-catch, return (or a method call) into a syntactically correct construct (e.g. add curly braces).

 

 

6.Run / Debug快捷键:

 

By pressing Alt+Shift+F10 you can access the Run/Debug dropdown on the main toolbar, without the need to use your mouse.

 

7. 关于提交代码:

 

 If you don't want to commit some of your changes to the repository, you can set them aside for a while, by moving to a separate changelist, or by putting them to a shelf. Select such file in the Local tab of the Changes tool window, and on the context menu choose Move to Another Changelist, or Shelve Changes.

 

8. 查看全局方法:

 

You can view all methods of the implemented interfaces in a class, if you place the caret at the implements keyword in the class declaration, press Alt+Shift+O, and select the desired interface from the list:

 

9。 查看一个方法的所以出口:

 

To view all exit points of a method, place the caret at one of them, e.g. the return statement, and press Alt+Shift+O:

 

10. 查看每一行代码最近的改变情况:

 

Version control annotations show the latest changes of each line in one click.
Just right-click an annotation and use the Show Diff command in the context menu.

 

 

 

11. 关于编辑正则表达式:

 

You can avoid escaping backslashes in your regular expressions. Start typing a regular expression, then press Alt+Enter and choose Edit RegExp. The regular expression opens in a separate tab in the editor, where you can type backslashes as is.
All changes are synchronized with the original regular expression, and escapes are presented automatically. When ready, just press Esc to close the regular expression editor.

 

 

 12. 使用shell脚本:

 

You don't need to leave Android Studio to work with your favorite shell. Just click the Terminal tool window button, and enjoy using the embedded local terminal.

 

目录
相关文章
|
3月前
|
Java Android开发 C++
Android Studio JNI 使用模板:c/cpp源文件的集成编译,快速上手
本文提供了一个Android Studio中JNI使用的模板,包括创建C/C++源文件、编辑CMakeLists.txt、编写JNI接口代码、配置build.gradle以及编译生成.so库的详细步骤,以帮助开发者快速上手Android平台的JNI开发和编译过程。
215 1
|
1月前
|
Java Unix Linux
Android Studio中Terminal运行./gradlew clean build提示错误信息
遇到 `./gradlew clean build`命令执行出错时,首先应检查错误信息的具体内容,这通常会指向问题的根源。从权限、环境配置、依赖下载、版本兼容性到项目配置本身,逐一排查并应用相应的解决措施。记住,保持耐心,逐步解决问题,往往复杂问题都是由简单原因引起的。
144 2
|
2月前
|
XML IDE 开发工具
🔧Android Studio高级技巧大公开!效率翻倍,编码不再枯燥无味!🛠️
【9月更文挑战第11天】在软件开发领域,Android Studio凭借其强大的功能成为Android开发者的首选IDE。本文将揭示一些提升开发效率的高级技巧,包括自定义代码模板、重构工具、高级调试技巧及多模块架构。通过对比传统方法,这些技巧不仅能简化编码流程,还能显著提高生产力。例如,自定义模板可一键插入常用代码块;重构工具能智能分析并安全执行代码更改;高级调试技巧如条件断点有助于快速定位问题;多模块架构则提升了大型项目的可维护性和团队协作效率。掌握这些技巧,将使你的开发之旅更加高效与愉悦。
62 5
|
3月前
|
Dart Android开发
Android Studio New里面没有New Flutter Project
Android Studio New里面没有New Flutter Project
135 1
Android Studio New里面没有New Flutter Project
|
3月前
|
编解码 Android开发
【Android Studio】使用UI工具绘制,ConstraintLayout 限制性布局,快速上手
本文介绍了Android Studio中使用ConstraintLayout布局的方法,通过创建布局文件、设置控件约束等步骤,快速上手UI设计,并提供了一个TV Launcher界面布局的绘制示例。
52 1
|
3月前
|
Android开发
Android Studio: 解决Gradle sync failed 错误
本文介绍了解决Android Studio中出现的Gradle同步失败错误的步骤,包括从`gradle-wrapper.properties`文件中获取Gradle的下载链接,手动下载Gradle压缩包,并替换默认下载路径中的临时文件,然后重新触发Android Studio的"Try Again"来完成同步。
1078 0
Android Studio: 解决Gradle sync failed 错误
|
3月前
|
Java Android开发 芯片
使用Android Studio导入Android源码:基于全志H713 AOSP,方便解决编译、编码问题
本文介绍了如何将基于全志H713芯片的AOSP Android源码导入Android Studio以解决编译和编码问题,通过操作步骤的详细说明,展示了在Android Studio中利用代码提示和补全功能快速定位并修复编译错误的方法。
106 0
使用Android Studio导入Android源码:基于全志H713 AOSP,方便解决编译、编码问题
|
3月前
|
API 开发工具 Android开发
Android Studio:解决AOSP自编译framework.jar引用不到的问题
在Android Studio中解决AOSP自编译framework.jar引用问题的几种方法,包括使用相对路径、绝对路径和通过`${project.rootDir}`动态获取路径的方法,以避免硬编码路径带来的配置问题。
151 0
Android Studio:解决AOSP自编译framework.jar引用不到的问题
|
3月前
|
Dart 开发工具 Android开发
Android Studio导入Flutter项目提示Dart SDK is not configured
Android Studio导入Flutter项目提示Dart SDK is not configured
256 4
|
3月前
|
Java 网络安全 开发工具
UNITY与安卓⭐一、Android Studio初始设置
UNITY与安卓⭐一、Android Studio初始设置