An open API service indexing awesome lists of open source software.

https://github.com/khaouitiabdelhakim/theme-showcase-android-kotlin

A simple Android app demonstrating light and dark theme implementation.
https://github.com/khaouitiabdelhakim/theme-showcase-android-kotlin

android android-application kotlin kotlin-android styles theme

Last synced: 7 months ago
JSON representation

A simple Android app demonstrating light and dark theme implementation.

Awesome Lists containing this project

README

          

# Android Theme Showcase

A simple Android app demonstrating light and dark theme implementation.

## Theme Preview

Light Mode
Dark Mode

## Features

- Toggle between light and dark themes
- Custom theme attributes
- Responsive UI elements
- Material Design components

## Setup

1. Clone the repository
2. Open in Android Studio
3. Run on a device or emulator

## Project Structure

- `attrs.xml` - Custom theme attributes
- `themes.xml` (in values) - Light theme configuration
- `themes.xml` (in values-night) - Dark theme configuration
- `MainActivity.kt` - Theme toggle implementation
- `activity_main.xml` - UI layout with theme-aware components

## Key Concepts

- Using `?attr/` references for theme-aware styling
- Creating custom theme attributes
- Implementing theme switching with `AppCompatDelegate`
- Using resource directories (`values-night`) for theme variants
- Translucent status bar implementation

## Implementation Notes

The theme toggle works by calling:
```kotlin
AppCompatDelegate.setDefaultNightMode(mode)
recreate() // Important to apply changes
```