Samples

Samples
样品
Welcome to code samples for Android developers. Here you can browse sample code and learn how to build different components for your applications. Use the categories on the left to browse the available samples.
欢迎来到安卓开发者示例代码。在这里你可以浏览代码示例并且学习到如何为你的程序创建不同的元素。使用左边的目录来浏览可用的示例。
Each sample is a fully functioning Android app. You can browse the resources, source files and see the overall project structure. You can copy and paste the code you need, and if you want to share a link to a specific line you can double-click it to the get the URL.
每个样例都是一个完整的APP。你可以浏览资源,资源目录以及查看完全的工程结构。你可以复制粘贴你需要的代码,如果你想要分享特殊的行,你可以双击它来获取URL

Import Samples from GitHub
从GitHub上导入代码

Android Studio provides easy access to import Android code samples from GitHub and is the recommended method to retrieve Android code samples.
Android studio 提供易用的方式从GitHub上导入代码并且推荐方法恢复样例代码
To import a code sample into Android Studio:
将样例代码导入到Android studio
  1. In the Android Studio menu, select File > Import Sample to open the Import Sample wizard.在Android studio菜单中,选择File>Import Sample打开导入代码向导程序
  2. Select a sample to import and click Next.选择想要导入的样品代码工程并点击下一步
  3. Specify the application name and project location if different from the displayed settings.如果和现实的设置名字不一样要指出应用程序名字和工程地址。
  4. Click Finish.点击完成
The sample project opens in a new Android Studio project.
样例程序在一个新的Android studio工程内打开
Note: When starting Android Studio, you can also select Import an Android code sample in the Welcome to Android Studio wizard to import a sample project from GitHub as a new project.
note:打开Android studio时你可以在欢迎引导页选择 Import an Android code sample   来导入来自于GitHubde 代码
For more information about importing samples, see Easy access to Android code samples on GitHub.
Download Samples
下载示例代码

Although importing samples from Android Studio is the recommended method, you can also use the categories on the left to browse the available samples and learn how to build different components for your applications.
虽然推荐从GitHub上导入代码,你也可以左边的目录浏览可用的代码并且学习如何为你的程序创建不同的元素
If you want to download a complete project, just click on any source file in the project and click the Download link in the upper right of the source page.
如果你想下载一个已经完成了的项目,点击工程的源文件和页面右上方的下载链接。
To import a downloaded project:
导入已下载的工程
  1. Unpack the downloaded project package.解压工程包
  2. In Android Studio, chose File > Import Project and select the root folder of the unpacked project.在Android studio里面,选择File > Import Project 然后选择被解压的文件夹的安卓项目文件   
Android Studio may ask you to choose the type of project you are importing. If this is the case, make sure to choose Import project from external model and select the Gradle option.
Android studio可能会让你选择你导入工程的类型。如果这样的话,选择 Import project from external model  然后选择 Gradle 选项
Note: When starting Android Studio, you can also select Import Non-Android Studio project in the Welcome to Android Studio wizard to import a downloaded sample project.
note:在启动Android studio的时候你也可以在Android studio欢迎引导页选择 Import Non-Android Studio project    来导入一个下载好的样本工程
Note: At this time, the downloadable projects are designed for use with Gradle and Android Studio.
note:现在,可下载的工程被设计成用Gradle 和Android studio
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值