0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Android Studioの環境設定(eclipseのショトカにするなど)

Last updated at Posted at 2018-09-06

9月から実際に開発現場で働きはじめて、そこで知った知識を共有します。

前提条件

Android Studio Version 3.1.4
Windows 10 HOME Version 1803, OS build 17134.228

Android Studioの環境設定

key bindをeclipseと同じにする。

File → Settings... → Keymap
一番の上のプルダウンでeclipseを選ぶ。

これでCtrl + Yキーで行が消えていったりはしません。
またF3で定義に飛べます。
(例えばクラスやメソッドの定義箇所に飛ぶなど)

あとはCtrl + PageUp, Ctrl + PageDownでタブが切り替えられます。

Projectツリーとエディタの連携

開いているソースに連動して、
Projectツリーのフォーカスも移動して欲しいやつ。

Projectツリーの右上にある歯車アイコン → Autoscroll to SourceとAutoscroll from Source。

これで開いているソースに場所にProjectツリーが連動しますので、
同じパッケージの違うソースが開きやすくなります。

保存時(Ctrl + Sキー)に自動でReformat CodeとOptimize Importsを走らせる

eclipseだと保存時アクション(名称うろ覚え)でコードのフォーマットなどを実行できますが、
Android Studioだと同様な機能がありません。
そのため、操作をマクロ化してCtrl + Sキーに割り当てます。
(Macでの手順はありましたがWindowsでは無かったので…)

  1. Code → Optimize Importsを実行
    初回だとウィンドウが出るので一度実行しておきます。

  2. Edit → Macros → Start Macro Recordingをクリック

  3. Code → Optimize Importsをクリック

  4. Code → Reformat Codeをクリック

  5. File → Save Allをクリック

  6. Edit → Macros → Stop Macro Recordingをクリック

  7. 適当な名前で保存する

  8. File → Settings... → Keymap

  9. 右側の一覧でKeymap → Macros → [さきほど保存したマクロ名]をダブルクリック

  10. Ctrl + Sキーに割り当てて保存(この画面の警告は無視)

  11. OK押すと警告が出るのでRemoveをクリック
    既にCtrl + Sキーに割り当てがあるよ?っていう警告なので上書きでOK。

今後もあれば追記していきますー。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?