android studio alt m,Android Studio 使用技巧

如果先前不熟悉 IntelliJ IDEA 界面,你可能会有些懵,这篇文章就提供些入门技巧。

d80c7eee7beb5b9d346d8990e6b87379.png

Figure 1. Gradle 项目文件结构图

项目文件结构

图1显示了项目文件结构,几乎所有自己项目的文件都在  src/ 文件夹中,包括资源文件 和 manifest 文件。之所以这样,是因为Android Studio采用了基于Gradle的编译系统。也就是,未来所有开发文件的修改都在 src/ 文件夹下了。参考:Gradle Plugin User Guide.

基本操作

创建虚拟设备

通过工具条上的 Android Virtual Device Manager

d3523b838df837b40ff594783e3aa5f7.png 打开管理器,创建新的虚拟设备在模拟器中运行app。

安装SDK更新

点击工具条上的 SDK Manager

f5cfdbcd2daa2a196a545554f759d25e.png 打开管理器检查更新(新工具、平台、库等)。

创建新文件

CTRL + N就可以了,如果希望直接在某个文件夹中创建,那就选中那个文件夹,然后CTRL + N。然后 Android Studio 会提供文件类型供选择。

For example, if you select a layout directory, press CTRL + N, and select Layout resource file, a dialog opens so you can name the file (you can exclude the .xml suffix) and choose a root view element. The editor then switches to the layout design editor so you can begin designing your layout.

创建布局

Android Studio 提供了布局编辑器,可以拖拽widgets 进布局,并预览,也可以同时编辑 xml。

While editing in the Text view, you can preview the layout on devices by opening the Preview pane available on the right side of the window. Within the Preview pane, you can modify the preview by changing various options at the top of the pane, including the preview device, layout theme, platform version and more. To preview the layout on multiple devices simultaneously, select Preview All Screen Sizes from the device drop-down.

You can switch to the graphical editor by clicking Design at the bottom of the window. While editing in the Design view, you can show and hide the widgets available to drag-and-drop by clicking Palette on the left side of the window. ClickingDesigner on the right side of the window reveals a panel with a layout hierarchy and a list of properties for each view in the layout.

如何调试

编译和运行app时,通过 DDMS 面板 的 adb 和设备日志了解运行信息。使用 Android Debug Monitor, 点击工具条上的Monitor

58a12291472c9380cf89f635503e251c.png启动。

快捷键

Table 1.Programming key commands

Action

Android Studio Key Command

补全

CTRL + SHIFT + A

Project quick fix

ALT + ENTER

格式化代码

CTRL + ALT + L (Win)

OPTION + CMD + L (Mac)

显示选中 API 的文档

CTRL + Q (Win)

F1 (Mac)

显示方法参数表

CTRL + P

创建方法

ALT + Insert (Win)

CMD + N (Mac)

Jump to source

F4 (Win)

CMD + down-arrow (Mac)

删除行

CTRL + Y (Win)

CMD + Backspace (Mac)

Search by symbol name

CTRL + ALT + SHIFT + N (Win)

OPTION + CMD + O (Mac)

Table 2. Project and editor key commands

Action

Android Studio Key Command

Build

CTRL + F9 (Win)

CMD + F9 (Mac)

Build and run

SHIFT + F10 (Win)

CTRL + R (Mac)

Toggle project visibility

ALT + 1 (Win)

CMD + 1 (Mac)

Navigate open tabs

ALT + left-arrow; ALT + right-arrow (Win)

CTRL + left-arrow; CTRL + right-arrow (Mac)

For a complete keymap reference guide, see the IntelliJ IDEA documentation.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值