International Islamic UniversityH-10, Islamabad, Pakistan
Mobile Applications Development
Week 04
Custom Fonts,
Styles & Theming
Engr. Rashid Farid Chishti
http://youtube.com/rfchishti
http://sites.google.com/site/chisht
i
2.
Learn toapply custom fonts to TextViews and Buttons.
Understand style resources for consistent UI design.
Explore app theming for light and dark modes.
Objectives
3.
Android allowsdevelopers to use custom fonts from the res/font/ directory.
Fonts can be applied via XML or Kotlin code.
Steps:
Add font files (jameel.ttf) to res/font/
Use it in XML or programmatically.
1. Applying Custom Fonts
Theme definesthe look and feel of the entire app.
Common attributes:
Primary color
Accent color
Background color
Font styles
Defined inside res/values/themes.xml.
3. Themes Overview
21.
Android supportsDayNight themes to automatically switch UI.
System-Wide Dark Mode (Android 10+)
When the user switches their phone to Dark Mode, apps can automatically
adapt if you provide both light and dark themes.
Values Folders for Themes
You define colors separately for light and dark themes
/res/values/colors.xml → Light theme colors
res/values-night/colors.xml → Dark theme colors
3. Light & Dark Mode Theming
Use stylesand themes for reusability.
Always keep light & dark mode in mind.
Test UI on multiple screen sizes.
Use Material Design guidelines for modern apps.
Best Practices