{"id":13644269,"url":"https://github.com/renaudcerrato/FloatingSearchView","last_synced_at":"2025-04-21T07:30:39.358Z","repository":{"id":39618045,"uuid":"48817971","full_name":"renaudcerrato/FloatingSearchView","owner":"renaudcerrato","description":"Yet another floating search view implementation, also known as persistent search.","archived":false,"fork":false,"pushed_at":"2022-10-20T11:21:51.000Z","size":10801,"stargazers_count":1328,"open_issues_count":17,"forks_count":161,"subscribers_count":25,"default_branch":"master","last_synced_at":"2025-04-14T18:51:50.197Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/renaudcerrato.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-30T20:18:59.000Z","updated_at":"2025-03-17T12:05:31.000Z","dependencies_parsed_at":"2023-01-19T17:33:05.333Z","dependency_job_id":null,"html_url":"https://github.com/renaudcerrato/FloatingSearchView","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renaudcerrato%2FFloatingSearchView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renaudcerrato%2FFloatingSearchView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renaudcerrato%2FFloatingSearchView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renaudcerrato%2FFloatingSearchView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/renaudcerrato","download_url":"https://codeload.github.com/renaudcerrato/FloatingSearchView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250014554,"owners_count":21360971,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T01:02:00.186Z","updated_at":"2025-04-21T07:30:39.326Z","avatar_url":"https://github.com/renaudcerrato.png","language":"Java","funding_links":[],"categories":["SearchView","Java"],"sub_categories":[],"readme":"# FloatingSearchView [![](https://img.shields.io/badge/android%20weekly-%23186-yellow.svg)](http://androidweekly.net/issues/issue-186) [![](https://jitpack.io/v/renaudcerrato/FloatingSearchView.svg)](https://jitpack.io/#renaudcerrato/FloatingSearchView)\n\n\nYet another floating search view implementation, also known as persistent search: that implementation fully supports menu (including submenu), logo and animated icon. Dropdown suggestions are backed by a `RecyclerView` and you can provide your own `RecyclerView.Adapter`, `ItemDecorator` or `ItemAnimator`. No hiding. \n\n[DEMO APK](https://github.com/renaudcerrato/FloatingSearchView/raw/master/sample/sample-debug.apk)\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://vid.me/bp7K\" target=\"_blank\"\u003e\n\u003cimg src=\"https://github.com/renaudcerrato/FloatingSearchView/raw/master/assets/demo.gif\"\u003e\n\u003c/a\u003e\n\u003c/p\u003e\n\n# Usage\n\nAdd a [`FloatingSearchView`](https://github.com/renaudcerrato/FloatingSearchView/blob/master/library/src/main/java/com/mypopsy/widget/FloatingSearchView.java) to your view hierarchy, make sure that it takes up the full width and height:\n\n```xml\n\u003ccom.mypopsy.widget.FloatingSearchView\n        android:id=\"@+id/search\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        android:paddingTop=\"16dp\"\n        android:paddingRight=\"8dp\"\n        android:paddingLeft=\"8dp\"\n        android:background=\"#90000000\"\n        android:hint=\"@string/hint\"\n        app:logo=\"@drawable/logo\"\n        app:fsv_menu=\"@menu/search\"/\u003e\n```\n\nSee the [supported attributes](https://github.com/renaudcerrato/FloatingSearchView/blob/master/library/src/main/res/values/attrs.xml).\n\nThen, configure your instance and set your listeners to react accordingly:\n\n```java\nmSuggestionsAdapter = new MySuggestionsAdapter(); // use a RecyclerView.Adapter\nmSearchView.setAdapter(mSuggestionsAdapter);\n...\nmSearchView.setOnIconClickListener(...);\nmSearchView.setOnSearchListener(...);  \nmSearchView.addTextChangedListener(...);\nmSearchView.setOnSearchFocusChangedListener(...);\n```\n\nLook at the [sample](https://github.com/renaudcerrato/FloatingSearchView/blob/master/sample/src/main/java/com/mypopsy/floatingsearchview/MainActivity.java).\n\n## Menu\n\nThe implementation fully supports menu (and submenu):\n\n```xml\n\u003ccom.mypopsy.widget.FloatingSearchView\n\t...\n\tapp:fsv_menu=\"@menu/search\"\n/\u003e\n```\n\n```java\nmSearchView.setOnMenuItemClickListener(...);\n```\n\nMenu items can be automatically hidden when the search view gets focus depending on the value of the MenuItem's `showAsAction`:\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003cmenu xmlns:android=\"http://schemas.android.com/apk/res/android\" xmlns:app=\"http://schemas.android.com/apk/res-auto\"\u003e\n    \u003citem android:id=\"@+id/menu1\" ... app:showAsAction=\"always\"/\u003e // always shown\n    \u003citem android:id=\"@+id/menu2\" ... app:showAsAction=\"ifRoom\"/\u003e // will hide on focus \n    \u003citem android:id=\"@+id/menu3\" ... app:showAsAction=\"never\"/\u003e  // will go into the overflow menu\n\u003c/menu\u003e\n```\n\n## Animated Icon\n\n`FloatingSearchView` will automagically animate icons drawable, given they declare a `progress` property: \n\n* `void setProgress(float)`\n* `float getProgress()`\n\n\u003e example: [`DrawerArrowDrawable`](https://developer.android.com/reference/android/support/v7/graphics/drawable/DrawerArrowDrawable.html) or [ToggleDrawable](https://github.com/renaudcerrato/ToggleDrawable)\n\n## Other\n\nSince the implementation tries to focus on core logic instead of business logic as much as possible, common features like *\"tap to clear\"*, *\"speech to text\"* or *\"loading progress\"* are voluntarily **NOT** built-in because they can be easily implemented using menu items as seen in the [sample](https://github.com/renaudcerrato/FloatingSearchView/blob/master/sample/src/main/java/com/mypopsy/floatingsearchview/MainActivity.java).\n\n\n# Styling\n\n`FloatingSearchView` do not expose most of TextView's XML attributes (`textColor`,`textSize`...). You can style them using theme attributes by applying [`app:theme`](https://chris.banes.me/2014/10/17/appcompat-v21)  for example:\n\nFirst, create a dedicated theme, possibly heriting from your application theme:\n\n```xml\n\u003c!-- your custom theme --\u003e\n\u003cstyle name=\"CustomFloatingSearchViewTheme\" parent=\"AppTheme\"\u003e\n    \u003citem name=\"editTextStyle\"\u003e@style/searchViewEditTextStyle\u003c/item\u003e\n    \u003citem name=\"android:divider\"\u003e#c9c9c9\u003c/item\u003e\n    \u003citem name=\"android:dividerHeight\"\u003e1dp\u003c/item\u003e\n    \u003citem name=\"colorControlNormal\"\u003e#696969\u003c/item\u003e\n\u003c/style\u003e\n\n\u003c!-- your custom search view text style --\u003e \n\u003cstyle name=\"searchViewEditTextStyle\" parent=\"Widget.AppCompat.EditText\"\u003e\n    \u003citem name=\"android:textSize\"\u003e18sp\u003c/item\u003e\n    \u003citem name=\"android:textColor\"\u003e?android:attr/textColorPrimary\u003c/item\u003e\n    \u003citem name=\"android:imeOptions\"\u003eactionSearch\u003c/item\u003e\n\u003c/style\u003e\n```\n\nThen, apply your custom theme through [`app:theme`](https://chris.banes.me/2014/10/17/appcompat-v21):\n\n```xml\n\u003ccom.mypopsy.widget.FloatingSearchView\n\t...\n\tapp:theme=\"@style/CustomFloatingSearchViewTheme\"\n/\u003e\n```\n\nLook at the [sample](https://github.com/renaudcerrato/FloatingSearchView/blob/master/sample/src/main/java/com/mypopsy/floatingsearchview/MainActivity.java).\n\n# Install\n\nThis repository can be found on JitPack:\n\nhttps://jitpack.io/#renaudcerrato/FloatingSearchView\n\nAdd it in your root build.gradle at the end of repositories:\n```\nallprojects {\n\t\trepositories {\n\t\t\t...\n\t\t\tmaven { url \"https://jitpack.io\" }\n\t\t}\n\t}\n```\n\nAdd the dependency:\n```\ndependencies {\n\t        compile 'com.github.renaudcerrato:FloatingSearchView:1.0.1'\n\t}\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frenaudcerrato%2FFloatingSearchView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frenaudcerrato%2FFloatingSearchView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frenaudcerrato%2FFloatingSearchView/lists"}