Working with resources like String, String array, Boolean, Dimension, Interger and Integer array

Опубликовано: 07 Октябрь 2024
на канале: Sarthak Education (C D Patel Digital Room)
245
19

Android Resources
In this tutorial you will learn about the Android Resources and its application with practical example.

Apart from coding there are many items which are used to develop a good Android Application, That all items are Resources like bitmaps, colors, strings , animation and many more. These resources are maintained in various sub-directories under res/ directory of the project.

Resource Types

Animation Resources : It define pre-define animations. Tween animations are saved in res/anim/ and accessed from the R.anim class, where Frame Animation are saved in res/drawable/ and accessed from the R.drawable class.

Color State List Resources : It define color resources that changes based on the View state. It contains list of colors. Colors are saved in res/color/ and accessed from the R.color class.

Drawable Resources : It defines various graphics with bitmap , It contains Image files like .png, .jpg , .gif and XML files. That all are saved in res/drawable/ and accessed from the R.drawable class.

Layout Resources : It define a user interface layout. It is saved in res/layout and accessed from R.layout class.

Menu Resources : It define contents of your application menus, like Options Menu, Context Menu etc. All menu XML files saved into res/menu/ and accessed from the R.menu class.

String Resources : It define string , string array and plurals. All are saved in res/values/ and accessed from R.string, R.array and R.plurals.

Style Resource : It defines look and format for UI elements. It is saved in res/style/ and accessed from the R.style class.

Values Resources: It contains values such as Booleans,integers, strings, dimensions , colors .That all are saved in res/values/ but accessed in different ways like R.bool for Booleans, R.dimen for dimensions etc.