0% found this document useful (0 votes)
3 views2 pages

Android UI Notes

The document provides notes on Android UI and preferences, detailing how to define preferences in XML, set up an AVD, and run apps on an emulator. It covers layout resources, form widgets, and different types of layouts, as well as the use of density-independent pixels (dp) and scale-independent pixels (sp) for UI design. Additionally, it explains shared preferences for small data storage and compares them with other storage options.

Uploaded by

shrutipimple2004
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

Android UI Notes

The document provides notes on Android UI and preferences, detailing how to define preferences in XML, set up an AVD, and run apps on an emulator. It covers layout resources, form widgets, and different types of layouts, as well as the use of density-independent pixels (dp) and scale-independent pixels (sp) for UI design. Additionally, it explains shared preferences for small data storage and compares them with other storage options.

Uploaded by

shrutipimple2004
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Android UI & Preferences Notes

1. Defining Preferences in XML


Preferences are defined in res/xml/ using . Example: EditTextPreference, CheckBoxPreference.

2. Location of Preference XML Files


Typically in res/xml/ directory.

3. Setting Up an AVD
Steps: Tools → Device Manager → Create Virtual Device → Select Hardware & System Image →
Configure → Finish.

4. AVD Features & Configurations


Device type, system image, RAM, storage, screen resolution, sensors, orientation, graphics.

5. Layout Resources
Defined in res/layout/. Separate UI design from logic. Support multiple screen sizes.

6. Example Layout
- defines a simple Hello World UI.

7. Running App on Emulator


Build project → Run → Select AVD → Gradle builds → App launches.

8. Form Widgets
Examples: EditText, Button, CheckBox, RadioButton, Spinner, Switch.

9. Types of Layouts
LinearLayout, RelativeLayout/ConstraintLayout, FrameLayout, TableLayout, GridLayout,
CoordinatorLayout.

10. dp vs px
dp = density-independent pixels, recommended for UI. px = physical pixels, rarely used.

11. sp for Text Size


sp = scale-independent pixels, respects user font settings, used for text.

12. Shared Preferences


Key-value storage for small data. Example: prefs.edit().putString().apply(); prefs.getString().

13. Shared Preferences vs Others


Preferences = small settings; Internal = private files; External = shared files; SQLite = structured
data; Providers = shared across apps.

14. Layout Types Recap


LinearLayout = forms, ConstraintLayout = complex UIs, FrameLayout = overlays, Table/GridLayout
= tabular data.

You might also like