如何在 Android Studio 中创建自定义键盘快捷键

How to create custom keyboard shortcut in Android Studio

我以前在 Eclipse 上工作,在那里我创建了一个模板来在 Android 中快速添加日志。 所以我开始输入一些东西,然后 IDE 自动完成为:

android.util.Log.d("SOME_TAG", "&{cursor}");

(一个例子,还有几个)

AndroidStudio 中是否有类似的功能? 我看过键盘映射设置,但找不到创建自定义元素的方法。

提前致谢。

找到这篇解释如何操作的文章。我要查找的术语是 Live Template https://medium.com/google-developers/writing-more-code-by-writing-less-code-with-android-studio-live-templates-244f648d17c7#.p3ech1tko

Go to File > Settings > Editor > Live Templates. Click the Android group, and press the plus button to add a new Live Template. You’ll want to choose an abbreviation to use the template, a description to remember what it does, and of course the code you’d like it to insert