在Android Studio中生成方法,就像在eclipse中一样。

3
我已从Eclipse迁移到Android Studio,我一直在使用生成委托方法来为某个类成员生成代码,像这样:enter image description here 输出结果如下:enter image description here 在Android Studio中是否可以做到这一点?

1
你尝试过使用 Alt+Enter 吗? - Cyanotis
1
@是的,我有,我也尝试过他们的生成委托方法,但它并不相同。 - Ofek Ron
2个回答

2

在Mac上,尝试使用cmnd+N,然后选择generate -> Delegate Methods。在Windows和Linux上,使用Alt+Insert。(仅在Mac上测试过)。


0

Android Studio可以像Eclipse一样生成方法:

  1. 选择要从中生成方法的代码。
  2. 然后在顶部选择“Code”下拉菜单 ->“Generate”。

您将有以下任何方法的生成选项:
- 构造函数
- Getter
- Setter
- Getter和Setter
- equals()和hashCode()
- toString()
- 覆盖方法
- 委托方法

此外,在Android Studio中生成方法的快捷键组合(在Windows操作系统上)是alt + ins


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接