material-components / material-components/material-components-android
[SearchBar] Support for trailing icon / avatar
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 17.4k
- Forks
- 3.2k
- PR merge metrics
- No merged PRs in 30d
Description
**Is your feature request related to a problem? Please describe.**
Though it is mentioned in the [anatomy](https://github.com/material-components/material-components-android/blob/master/docs/components/Search.md#anatomy-and-key-properties) of a `SearchBar` it seems not to be possible to add a trailing icon / avatar to it.
I tried to add a nested `ImageView` but it seems to be ignored. I also search for public methods, but not even in the class itself I was able to find any hint about `avatar` or `trailing`.
**Describe the solution you'd like**
Nesting an `ImageView` or a public `setter`.
**Describe alternatives you've considered**
Rebuilding the whole `SearchBar` from scratch custom
**Additional context**
It's about item `4`:

We also happily accept [pull requests](https://github.com/material-components/material-components-android/pulls).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the SearchBar implementation and the linked Search.md anatomy section, then inspect how child views and public customization are handled. Determine whether the supported outcome should be a nested ImageView, a public setter, or another API, and consider how the trailing icon or avatar should appear in the component.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100