6

How to implement Search Edit text like Google play with Back and Cancel button on Right at place of Voice search and suggestions list should display below the complete edit text layout.

enter image description here

Krishnakant
  • 1,453
  • 3
  • 18
  • 30

2 Answers2

3

This is SearchView with some customization check the docs http://developer.android.com/guide/topics/search/search-dialog.html

Actvity declared like this

<activity android:name=".SearchableActivity"
          android:launchMode="singleTop" >
    <intent-filter>
        <action android:name="android.intent.action.SEARCH" />
    </intent-filter>
    <meta-data android:name="android.app.searchable"
                      android:resource="@xml/searchable"/>
  </activity>

and SearchView xml

<?xml version="1.0" encoding="utf-8"?>
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
    android:label="@string/search_label"
    android:hint="@string/search_hint"
    android:voiceSearchMode="showVoiceSearchButton|launchRecognizer" >
</searchable>

Also you would need to override the onSearchRequested

@Override
public boolean onSearchRequested() {
     Bundle appData = new Bundle();
     appData.putBoolean(SearchableActivity.JARGON, true);
     startSearch(null, false, appData, false);
     return true;
 }
QAMAR
  • 2,684
  • 22
  • 28
1

The are some awesome libraries provide the Search view you want, like:
Floating Search View

enter image description here enter image description here

And more:
https://github.com/lapism/SearchView
https://github.com/Quinny898/PersistentSearch

Khang .NT
  • 1,504
  • 6
  • 24
  • 46