Search View Layout

Material Design Search View Layout, now implemented in Google Maps, Dialer, etc
Alternatives To Search View Layout
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Search View Layout1,089
5 years ago1May 22, 20184apache-2.0Java
Material Design Search View Layout, now implemented in Google Maps, Dialer, etc
Jekyll Theme Basically Basic782
3422 days ago15July 06, 20219mitSCSS
Your new Jekyll default theme.
Search Dialog473
3 years ago2apache-2.0Java
An easy to use, yet very customizable search dialog
3 years agon,ullmitKotlin
Simple library to have a hidden/shown search bar
Freetube Vue125
3 years agoagpl-3.0JavaScript
The repository for the upcoming FreeTube rewrite
Search Layout119
a year ago14JavaScript
A basic search screen layout for usage with React Navigation.
Ci4 Album84
4 months ago37August 29, 2021mitPHP
🔥 CodeIgniter 4 example Album module uses Domain Driven Design Architecture with Tactical Pattern
Google Search Sidebar68
2 months ago2mitCSS
A user script and user style to move Google search tools to sidebar.
a year agoapache-2.0CSS
3 years ago14otherRuby
DEPRECATED - Jekyll search plugin based on lunr.js and jekyll_pages_api
Alternatives To Search View Layout
Select To Compare

Alternative Project Comparisons


Component is not maintained anymore.

Implementation of Lollipop+ Dialer and Google Maps.



Add in View

Add to your layout by using the include tag.

<include layout="@layout/widget_search_bar"/>


This overlays the full activity and shows the fragment which you have assigned by using setExpandedContentFragment.

searchViewLayout.setExpandedContentFragment(this, new SearchStaticFragment());

If you want to animate your Toolbar too like the demo gif, you can enable it by using handleToolbarAnimation.


Setting Background colors for Transition. Default should also work just fine:

// Create Drawable for collapsed state. Default color is android.R.color.transparent
ColorDrawable collapsed = new ColorDrawable(
    ContextCompat.getColor(this, R.color.colorPrimary));

// Create Drawable for expanded state. Default color is #F0F0F0
ColorDrawable expanded = new ColorDrawable(
    ContextCompat.getColor(this, R.color.default_color_expanded));

// Send both colors to searchViewLayout
searchViewLayout.setTransitionDrawables(collapsed, expanded);

Listen to search complete by:

searchViewLayout.setSearchListener(new SearchViewLayout.SearchListener() {
    public void onFinished(String searchKeyword) {
        Snackbar.make(searchViewLayout, "Search Done - " + searchKeyword, Snackbar.LENGTH_LONG).show();

Listen to collapse/expand animation by using setOnToggleAnimationListener. For eg the FAB in demo hides on expanded and shows on collapse.

searchViewLayout.setOnToggleAnimationListener(new SearchViewLayout.OnToggleAnimationListener() {
    public void onStart(boolean expanded) {
        if(expanded) {
        } else {

    public void onFinish(boolean expanded) { }

Listen to search box complete by:

searchViewLayout.setSearchBoxListener(new SearchViewLayout.SearchBoxListener() {
    public void beforeTextChanged(CharSequence s, int start, int count, int after) {
    public void onTextChanged(CharSequence s, int start, int before, int count) {
    public void afterTextChanged(Editable s) {

Setting Hints

If you want to set hints in the view, there are three APIs. setCollapsedHint would come up in the default/collapsed state. setExpandedHint would work for expanded state i.e. after click the view and the keyboard is up. setHint would set both the hints in one go, use this you want to show the same hint in both the states.

searchViewLayout.setCollapsedHint("Collapsed Hint");
searchViewLayout.setExpandedHint("Expanded Hint");
searchViewLayout.setHint("Global Hint");

Setting Icons Use setCollapsedIcon, setExpandedBackIcon, setExpandedSearchIcon to setup icons according to your choice. The argument should be a DrawableRes


  1. If you want to add a scrolling widget in your setExpandedContentFragment, add a onTouchListener and disallow the parent intercept by usingv.getParent().requestDisallowInterceptTouchEvent(true);Check out fragments in sample for the implement of ListView, RecyclerView and ScrollView.

    recyclerView.setOnTouchListener(new View.OnTouchListener() {
        // Setting on Touch Listener for handling the touch inside ScrollView
        public boolean onTouch(View v, MotionEvent event) {
            // Disallow the touch request for parent scroll on touch of child view
            return false;
  2. The default height of the view is 120dp which is also present in the dimens.xml file as

    <dimen name="search_view_layout_approx_height">120dp</dimen>

    You can use it for adding margin on top of your main content layout.


Available at jCenter and mavenCentral.

dependencies {
    compile 'xyz.sahildave:searchviewlayout:0.6'



  • Added support for API 15


  • Added support for fragment-v4


  • Moved anim files to /animator res dir


  • Added search edit text API
  • Larger touch target


  • Added APIs for setting icons
  • Improved animations by using onAnimationUpdate


  • Added hints API.
  • Added search_view_layout_approx_height


  • Added API setTransitionDrawables which solves crashes in < API 19


Contribute by creating issues (tagged enhancement, bugs) in the repo or create a pull request.

Popular Layout Projects
Popular Search Projects
Popular User Interface Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Material Design
Google Maps
Search Interface