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

[Search Bar] Setting searchBar.setText(...) does not work without android:windowSoftInputMode="adjustNothing"

Open
#3,360 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Widget: Search
Dominant language
Java
Stars
17.4k
Forks
3.2k
PR merge metrics
No merged PRs in 30d

Description

**Description:** I have copied your code from `SearchRecyclerDemoActivity` and while playing with search bar I have noticed that doing `searchBar.setText(...)` inside `submitSearchQuery()` does nothing (no effect). Once I have configured `android:windowSoftInputMode="adjustNothing"` in my activity, it started working.

**Expected behavior:** `searchBar.setText(...)` should work even without setting windowSoftInputMode. (IDK, I am new to android, but I guess it should not depend on windowSoftInputMode)

**Source code:**
```


```

**Android API version:** 33

**Material Library version:** 1.9.0-rc01

**Device:** xiaomi mi note 10 lite (MIUI Global 12.5.6 Stable)

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

Reproduce the behavior from SearchRecyclerDemoActivity using the provided CoordinatorLayout, SearchBar, SearchView, and submitSearchQuery() setup, comparing default behavior with windowSoftInputMode="adjustNothing". Trace how SearchBar.setText(...) is handled in Material Library 1.9.0-rc01 on Android API 33, then verify that the text update works without that window setting.

Written by the indexing model from the issue text.

Assessment

Tech stack
android
Domain
mobile
Issue type
Bug
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.