Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/hanggrian/collapsingtoolbarlayout-subtitle

Standard CollapsingToolbarLayout with subtitle support
https://github.com/hanggrian/collapsingtoolbarlayout-subtitle

android material-components material-design

Last synced: about 1 month ago
JSON representation

Standard CollapsingToolbarLayout with subtitle support

Awesome Lists containing this project

README

        

[![Travis CI](https://img.shields.io/travis/com/hendraanggrian/collapsingtoolbarlayout-subtitle)](https://travis-ci.com/github/hendraanggrian/collapsingtoolbarlayout-subtitle/)
[![Codecov](https://img.shields.io/codecov/c/github/hendraanggrian/collapsingtoolbarlayout-subtitle)](https://codecov.io/gh/hendraanggrian/collapsingtoolbarlayout-subtitle/)
[![Maven Central](https://img.shields.io/maven-central/v/com.hendraanggrian.material/collapsingtoolbarlayout-subtitle)](https://repo1.maven.org/maven2/com/hendraanggrian/material/collapsingtoolbarlayout-subtitle/)
[![Nexus Snapshot](https://img.shields.io/nexus/s/com.hendraanggrian.material/collapsingtoolbarlayout-subtitle?server=https%3A%2F%2Fs01.oss.sonatype.org)](https://s01.oss.sonatype.org/content/repositories/snapshots/com/hendraanggrian/material/collapsingtoolbarlayout-subtitle/)
[![Android SDK](https://img.shields.io/badge/sdk-14%2B-informational)](https://developer.android.com/studio/releases/platforms/#4.0)

# SubtitleCollapsingToolbarLayout

![Material preview.](https://github.com/hendraanggrian/collapsingtoolbarlayout-subtitle/raw/assets/preview_material.gif)
![Material You preview.](https://github.com/hendraanggrian/collapsingtoolbarlayout-subtitle/raw/assets/preview_material3.gif)

A carbon copy of [CollapsingToolbarLayout](https://developer.android.com/reference/com/google/android/material/appbar/CollapsingToolbarLayout/)
with subtitle support. During collapsed state, the subtitle would still appear
as Toolbar's. There should be no learning curve because it works just like
`CollapsingToolbarLayout`. Supports Material Design 3 styling.

But because this library uses restricted APIs and private resources from [Material Components](https://github.com/material-components/material-components-android/),
there are a few caveats:

- Only safe to use with the same version of material components.
- Deceptive package name.

### Also...

It is detabable if we even need this library. If the material guidelines says
it's ok to have a subtitle in toolbar layout, then they surely would've already
implemented such feature. If it doesn't say anything about subtitle (which is
odds because Toolbar has it), then we probably shouldn't use it out of respect
to the guidelines.

## Download

This library's versioning follows [Material Components releases](https://github.com/material-components/material-components-android/releases/).
Which in turn, follows [AndroidX releases](https://developer.android.com/jetpack/androidx/versions/).

```gradle
repositories {
mavenCentral()
google()
}
dependencies {
implementation "com.hendraanggrian.material:collapsingtoolbarlayout-subtitle:$version"
}
```

## Usage

Treat `SubtitleCollapsingToolbarLayout` just like a regular
`CollapsingToolbarLayout`.

```xml



```

### Material Design 3

![Material3 medium style.](https://github.com/hendraanggrian/collapsingtoolbarlayout-subtitle/raw/assets/material3_style_medium.png)
![Material3 large style.](https://github.com/hendraanggrian/collapsingtoolbarlayout-subtitle/raw/assets/material3_style_large.png)

`SubtitleCollapsingToolbarLayout` will automatically switch to Material Design 3
style by using `Theme.Material3.*` in your app, no configuration needed.

By default, medium style is applied. To use large style, reference an attribute
`subtitleCollapsingToolbarLayoutLargeStyle` in your XML.

```xml

```