material-components / material-components/material-components-android

[SearchBar] Support for trailing icon / avatar

Open
#3,281 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request Widget: Search
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`:

![grafik](https://user-images.githubusercontent.com/4741199/222432267-3f2c23e3-cb04-44dd-8d90-f629f5c15f46.png)

We also happily accept [pull requests](https://github.com/material-components/material-components-android/pulls).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.