如何在Android Studio中自动实施建议? [英] How to auto implement suggestions in Android Studio?

查看:87
本文介绍了如何在Android Studio中自动实施建议?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何像Eclipse一样在Android Studio中自动实施建议.有什么主意吗?
在Eclipse中,我们可以单击建议,以便由Eclipse自己实现.

How can I auto implement suggestions in Android Studio just like Eclipse. Any idea?
In Eclipse we can click on the suggestions so that it will get implemented by Eclipse itself.

例如.如果我通过IDE获得了建议,则在eclipse中如果从内部类内部访问的变量应声明为final",则我可以单击并通过IDE本身来实现该建议.无需手动进行.这就是我所需要的.

Eg. "If a variable accessed from within an inner class it should be declared final" in eclipse if I get this suggestion by the IDE I am able to click and implement that suggestion by IDE itself. No need to do it manually. that's what I need.

推荐答案

我不确定您的意思,但是Android Studio中有一些重要的快捷方式:

I am not sure what you mean but there are a few important shortcuts in Android Studio:

  • 生成:

  • 在Mac上: CTRL + ENTER
  • 在Windows上: ALT + INSERT
  • On Mac: CTRL + ENTER
  • On Windows: ALT + INSERT

使用此快捷方式,您可以生成很多东西,例如构造函数,getter和setter,正确的equals()hashCode()实现,覆盖或实现方法……总体而言,它非常强大且非常有用.

With this shortcut you can generate a lot of things like constructors, getters and setters, correct equals() and hashCode() implementations, overriding or implementing methods... Overall its very powerful and very useful.

快速修复:

  • 在Mac上: ALT + ENTER
  • 在Windows上: ALT + ENTER
  • On Mac: ALT + ENTER
  • On Windows: ALT + ENTER

使用此快捷方式,您可以修复最常见的错误,并且可以为您完成很多工作.您永远不要低估IntelliJ/Android Studio中强大的重构和快速修复功能.

With this shortcut you can fix most common errors and it can do a lot of work for you. You should never underestimate how powerful refactoring and quick fix are in IntelliJ/Android Studio.

代码完成

  • 在Mac上: CTRL + SPACE
  • 在Windows上: CTRL + SPACE
  • On Mac: CTRL + SPACE
  • On Windows: CTRL + SPACE

顾名思义,这是您的基本代码完成.默认情况下,它仅显示您以前使用过的最相关的建议和/或类别,通过两次单击此快捷方式,您可以显示所有建议.

As the name implies this is your basic code completion. By default it shows you only the most relevant suggestions and/or classes you have used before, by hitting this shortcut twice you can show all suggestions.

显示参数

  • 在Mac上: + P
  • 在Windows上: CTRL + P
  • On Mac: + P
  • On Windows: CTRL + P

这向您显示了当前方法的参数及其所有重载,在我看来,这是最被低估的快捷方式之一,因为它可以使您的生活轻松很多.

This shows you parameters of the current method and all of its overloads, this is among the most underrated shortcuts in my opinion as it can make your life a lot easier.

这篇关于如何在Android Studio中自动实施建议?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆