Search editText animation like Chrome app

蓝咒 提交于 2019-12-10 13:48:48

问题


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?


回答1:


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).



来源:https://stackoverflow.com/questions/33985592/search-edittext-animation-like-chrome-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!