安卓工程结构Basic Android project structure

After you have installed all the plug-ins necessary for the development of an Android file, you can now begin to develop an Android application. From the top menu, choose File -> Project, and from the "New Project window", choose "Android Project". Follow the project setup wizard and after finishing the wizard, you will have a basic Android application.Every Android project contains several folders:

  • src: This folder contains the Java source files.
  • gen: Generated Java library, this library is for Android internal use only.
  • Res: Here we can store resource files such as pictures, XML files for defining layouts, and so forth. Within this folder there are additional folders such asDrawable,Layout, and Values.
  • Drawable: Here we store the various graphic files. We can see three types of drawable folders. This is because there are many Android devices with different screen resolutions. By default, there are several versions of this folder such as:Drawable-mdpi,drawable-hdpi, and so forth. This is required in order to adapt to different screen resolutions.
  • Layout: This is the place for XML layout files. Layout files are XML files which define how various Android objects (such as textboxes, buttons, etc.) are organized on the screen.
  • Values: XML files which store various string values (titles, labels, etc.).

Major files in the Android project:

  • AndroidManifest.xml: This is the Android definition file. It contains information about the Android application such as minimum Android version, permission to access Android device capabilities such as internet access permission, ability to use phone permission, etc.
  • MainLayout.xml: This file describes the layout of the page. This means the placement of every component (such as textboxes, labels, radio buttons, user defined components, etc.) on the app screen.
  • Activity class: Every application that occupies the entire device screen needs at least one class which inherits from theActivity class. One major method is calledOnCreate. This method initiates the app and loads the layout page.

gen下面的R.java是在建立项目时自动生成的,这个文件是只读模式,不能更改,R.java文件是定义该项目所有资源的索引文件。

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值