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 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.

 

时间: 2024-09-09 00:25:33

Android Studio常用小技巧的相关文章

Android ListView常用小技巧汇总_Android

ListView在我们Android项目中的地位是有目共睹的,相信几乎每一个App中都有它的身影. ListView主要是用列表形式来加载数据,在特定情况下需要实现一些特殊功能:如刷新数据,加载数据,实现动画效果等. 作为我们常用的控件,有哪些需要注意的呢? **为ListView的每一Item设置分隔线 第一种方法:也是最简单地方法,在布局文件中设置ListView的 divider属性 如:android:divider="@color/black" 第二种方法:设置android

Android ListView常用小技巧汇总

ListView在我们Android项目中的地位是有目共睹的,相信几乎每一个App中都有它的身影. ListView主要是用列表形式来加载数据,在特定情况下需要实现一些特殊功能:如刷新数据,加载数据,实现动画效果等. 作为我们常用的控件,有哪些需要注意的呢? **为ListView的每一Item设置分隔线 第一种方法:也是最简单地方法,在布局文件中设置ListView的 divider属性 如:android:divider="@color/black" 第二种方法:设置android

你值得拥有的Android Studio开发小技巧_Android

上一次发过了一个介绍Studio的,这里再发一个补充下. 我们都知道,Android Studio的功能是非常强大的,也是很智能的.如果有人告诉你学Android开发要用命令行,你可以告诉他Android Studio是谷歌提供给开发者提升效率的.试想想你脑袋里有一堆想法,但是开发编码效率太低导致想法都丢失了或者兴趣消失了多可怕对不.好了废话不多说,这里介绍几个比较好用的技巧和快捷键,提升我们的编码效率. 1.完成一句代码 如果我们调用了一个方法,并给方法传递了参数,这个时候如果我们要结束这个语

Android Studio使用小技巧:自定义Logcat_Android

我们都知道Logcat是我们Android开发调试最常用的一个工具,但是Android Studio默认的Logcat调试的颜色是一样的,我们不好区分verbose.debug.error等分类信息,今天就来教大家自定义Logcat的提示信息. 打开Preference->Editor->Colors & Fonts->Android Logcat(或者搜索logcat),如果我们默认选择的是Darcula主题会看到如下界面: 这个默认的是无法更改,我们可以点击"Sav

Android Studio使用小技巧:自定义Logcat

我们都知道Logcat是我们Android开发调试最常用的一个工具,但是Android Studio默认的Logcat调试的颜色是一样的,我们不好区分verbose.debug.error等分类信息,今天就来教大家自定义Logcat的提示信息. 打开Preference->Editor->Colors & Fonts->Android Logcat(或者搜索logcat),如果我们默认选择的是Darcula主题会看到如下界面: 这个默认的是无法更改,我们可以点击"Sav

你值得拥有的Android Studio开发小技巧

上一次发过了一个介绍Studio的,这里再发一个补充下. 我们都知道,Android Studio的功能是非常强大的,也是很智能的.如果有人告诉你学Android开发要用命令行,你可以告诉他Android Studio是谷歌提供给开发者提升效率的.试想想你脑袋里有一堆想法,但是开发编码效率太低导致想法都丢失了或者兴趣消失了多可怕对不.好了废话不多说,这里介绍几个比较好用的技巧和快捷键,提升我们的编码效率. 1.完成一句代码 如果我们调用了一个方法,并给方法传递了参数,这个时候如果我们要结束这个语

Android Studio使用小技巧:布局预览时填充数据_Android

我们都知道Android Studio用起来很棒,其中布局预览更棒.我们在调UI的时候基本是需要实时预览来看效果的,在Android Studio中只需要切换到Design就可以看到,而且我们需要在布局上填充数据预览效果更好,比如我们在TextView中设定text属性来看下字体大小与布局是否正确,但是呢正式环境我们又需要移除这些额外的数据,不然看着很不舒服,这个时候就用到了本篇博客介绍的一个技巧. 废话不多说,直接上图: 上述示例中只需要在xml布局文件中添加tools命名空间的text属性就

Android Studio使用小技巧:提取方法代码片段_Android

今天来给大家介绍一个非常有用的Studio Tips,有些时候我们在一个方法内部写了过多的代码,然后想要把一些代码提取出来再放在一个单独的方法里,通常我们的做法是复制粘贴,现在我来教给大家一个非常简洁的方法,先看下gif演示吧: 怎么样很方便吧?操作方法很简单,只需要选中一些代码,然后操作快捷键 Cmd + Option + M 就ok了,Windows是 Ctrl + Alt + M,很简单方便的一个小技巧分享给大家.

Android Studio 使用小技巧

1.如何打开设置界面?      File --> Settings          快捷键  Ctrl + Alt  + s   2.修改Java文件字体大小 ?      File --> Settings --> Editor --> Colors& Fonts --> Font        3.代码格式化时显示的样式 ?       Settings --> Code Style .同样的, Scheme 中默认的配置,你无法修改,你需要创建一份自己