51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 1043|回复: 0
打印 上一主题 下一主题

【转载】Android Studio 使用技巧(4)

[复制链接]
  • TA的每日心情
    擦汗
    8 小时前
  • 签到天数: 1047 天

    连续签到: 5 天

    [LV.10]测试总司令

    跳转到指定楼层
    1#
    发表于 2016-4-28 15:03:04 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
    About Keymaps

    Android Studio provides different keymaps (the mapping between shortcut keys and an action). You can see which keymap you are using in Settings->Keymap.

    It wouldn’t be practical to list the shortcuts for every keymap so the following will be used:

    • Windows: Default
    • Linux: Default
    • OSX: Mac OSX 10.5+

    Analyze Data flow to Here

    This will take the current variable, parameter or field and show you the path it has taken to get here! This is very useful when you are entering an unfamiliar place in the code base and you want to understand how this parameter got there.

    There is also the reverse operation “Analyze Data Flow from Here” that will show you where your variable, field or return type will end up.

    Shortcut : There is no keyboard shortcut for this…

    • Menu: Analyze → Analyze Data Flow to Here
    • Find action: Analyze Data Flow to Here

    Sublime Text Multi Selection

    This one is particularly nice!
    It will take the current selection, select the next occurrence and add a cursor there. This means that you can have multiple cursors in the same file! Everything you type will be written at each cursor.

    Shortcut :

    • Mac : Ctrl+G
    • Windows/Linux: Alt+J

    Column Selection

    Enable column selections, also known as block selection. Basically, if you select down, it will go down and not bother wrapping to the end of the line.

    This will also put a cursor after each line of the block selection from where you can type.

    Shortcut :

    • Mouse: Alt+MouseDrag
    • Mac : Cmd+Shift+8
    • Windows/Linux: Shift+Alt+Insert

    Postfix Completion

    This one is not very intuitive but still pretty powerful. Basically, it is a way to wrap the current statement in something else without having to press the left key a bunch of times to get there.

    E.g. to iterate a list, you could go “myList.for”, press tab and it would generate the for loop for you.

    You can get a list of what you can type by typing a dot after a statement and looking through the options after all the possible completions.

    Some of my personal favorites:

    • .for (for a foreach)
    • .format (wraps a string in String.format())
    • .cast (wraps a statement in a type cast)

    Compare With Clipboard

    This will take the current selection and do a diff with the content of your clipboard.

    Shortcut:

    • Mouse: right-click the selection and select Compare With Clipboard
    • Find action: compare with clipboard

    Stop Process

    This will stop the currently running task or show a list of possible tasks to stop if there is more than one.

    Pretty useful to stop debugging or abort a build.

    Shortcut :

    • Mac : Cmd+F2
    • Windows/Linux: Ctrl+F2

    Show Execution Point

    This will put the cursor back to where you are debugging right now.

    The usual case is:

    • You break somewhere
    • You start looking around in this file and then a bunch of other files
    • You invoke this shortcut to return exactly to where you were in your step-by-step debugging session

    Shortcut (when debugging) : Alt+F10


    VCS Operations Popup

    This will show you the most frequent version control operations. If your project is not under Git or another sytem, it will at least give you a local history maintained by Android Studio.

    Shortcut :

    • Mac: Ctrl+V
    • Windows/Linux: Alt+`

    Compare With Branch (Git)

    Assuming that your project is under Git, you can compare the current file or folder with another branch. Pretty useful to get an idea of how much you have diverged from your main branch.

    Shortcut :


    分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
    收藏收藏
    回复

    使用道具 举报

    本版积分规则

    关闭

    站长推荐上一条 /1 下一条

    小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

    GMT+8, 2024-11-15 17:31 , Processed in 0.077968 second(s), 22 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

    快速回复 返回顶部 返回列表