There are many more items which you use to build a good
Android 
application. Apart from coding for the application, you take care of
various other resources like static content that your code uses, such as
bitmaps, colors, layout definitions, user interface strings, animation
instructions, and more.
app/src/main/res/layout/activity_my.xml
This XML layout file is for the activity you added when you created
the project with Android Studio. Following the New Project workflow,
Android Studio presents this file with both a text view and a preview of
the screen UI. The file contains some default interface elements from
the material design library, including the app bar and a floating action
button. It also includes a separate layout file with the main content.
app/src/main/java/com.example.helloworld/MainActivity.java
A tab for this file appears in Android Studio when the New Project
workflow finishes. When you select the file you see the class definition
for the activity you created. When you build and run the app, the
Activity class starts the activity and loads the layout file that says
"Hello World!"
app/src/main/AndroidManifest.xml
The manifest file describes the fundamental characteristics of
the app and defines each of its components. You'll revisit this file as
you follow these lessons and add more components to your app.
Resources
drawable/
Directories for drawable resources, other than launcher icons, designed for various densities.
layout/
Directory for files that define your app's user interface like
activity_my.xml, discussed above, which describes a basic layout for the
MyActivity class.
menu/
Directory for files that define your app's menu items.
mipmap/
Launcher icons reside in the mipmap/ folder rather than the
drawable/ folders. This folder contains the ic_launcher.png image that
appears when you run the default app.
values/
Directory for other XML files that contain a collection of resources, such as string and color definitions.
| Directory |
Resource Type |
| anim/ |
XML files that define property animations. They are saved in res/anim/ folder and accessed from the R.anim class. |
| color/ |
XML files that define a state list of colors. They are saved in res/color/ and accessed from the R.color class. |
| drawable/ |
Image files like .png, .jpg, .gif or XML files that are compiled
into bitmaps, state lists, shapes, animation drawable. They are saved in
res/drawable/ and accessed from the R.drawable class. |
| layout/ |
XML files that define a user interface layout. They are saved in res/layout/ and accessed from the R.layout class. |
| menu/ |
XML files that define application menus, such as an Options Menu,
Context Menu, or Sub Menu. They are saved in res/menu/ and accessed from
the R.menu class. |
| raw/ |
Arbitrary files to save in their raw form. You need to call Resources.openRawResource() with the resource ID, which is R.raw.filename to open such raw files. |
| values/ |
XML files that contain simple values, such as strings, integers, and
colors. For example, here are some filename conventions for resources
you can create in this directory −
- arrays.xml for resource arrays, and accessed from the R.array class.
- integers.xml for resource integers, and accessed from the R.integer class.
- bools.xml for resource boolean, and accessed from the R.bool class.
- colors.xml for color values, and accessed from the R.color class.
- dimens.xml for dimension values, and accessed from the R.dimen class.
- strings.xml for string values, and accessed from the R.string class.
- styles.xml for styles, and accessed from the R.style class.
|
| xml/ |
Arbitrary XML files that can be read at runtime by calling Resources.getXML(). You can save various configuration files here which will be used at run time. |