8 Drawable Resources
8 Drawable Resources
Mobile Application
Model
Android resources
• All Android applications are composed of two things:
2. Data (resources)
• Resources include text strings, styles and themes, dimensions, images and
icons, audio files, videos, and other data used by the application.
What are the Android resources?
• Resources are the additional files and static content that your code uses,
such as
• bitmaps
• layout definitions
• user interface strings
• animation instructions
• and more.
• Always externalize app resources such as images and strings from your
code, so that you can maintain them independently.
What is layout resource in Android?
• A layout resource defines the architecture for the UI in an
Activity or a component of a UI.
file location: res/layout/filename.xml
• The filename is used as the resource ID. compiled resource
datatype: Resource pointer to a View (or subclass) resource
resource reference:
In Java: R.layout.filename
What is @+ ID in Android layout?
• @+id is used for defining a resource where as @id is used
for referring the resources which is already defined.
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/my_image"
android:contentDescription="@string/my_image_desc" />
• layout folder
• mipmap folder
Drawable
Resources
XML in
Android
Studio
Drawable Resources – Android Studio
Drawable
Resources
XML in
Android
Studio
Drawable Resources – Android Studio
Drawable
Resources
XML in
Android
Studio
Questions
Thank You