Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Search editText animation like Chrome app

I'm trying to make a search editText in the middle of screen,

That whenever pressed, move with animation to the searchView in the toolbar.

Exactly as you can find in new tab of chrome app (v46) for android.

Didn't find any Github example, so any idea how to implement that?

enter image description here

like image 564
David Avatar asked Nov 29 '15 17:11

David


1 Answers

I've created a gist to show one way that this can be done: https://github.com/orenothnay/SearchBar

The main component is FocusableEditText (which I adapted from androids searchview widget). It uses a workaround to allow the edit text to lose focus once the user removes the keyboard. and then you just listen to the focus change event and change your UI accordingly.

The caveates are: It must be wrapped in a focus stealing ViewGroup, and must be told to clear focus on pause (else the keyboard stays up).

like image 62
Oren Avatar answered Nov 10 '22 19:11

Oren