I'm building an app that makes use of Google Maps API, and I want it to have a floating search bar at the top, exactly like the one present in Google Maps app.
I've found out about Places Autocomplete, but the application will not search for places but another kind of data that the users will have created.
I've also found out about a library named Float Search View, but it's been discontinued for some time already, therefore I'd like to pass on this. I'd also like to create it manually because this is the first Android app I'll be building, I want to learn.
I have tried implementing a SearchView
in my XML:
<android.support.v7.widget.SearchView
android:id="@+id/searchView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:iconifiedByDefault="false"
app:queryHint="@string/search_hint"
android:theme="@style/SearchBar"/>
With a white background and elevation:
<style name="SearchBar">
<item name="android:background">@color/colorPrimary</item>
<item name="android:elevation">4dp</item>
</style>
To see if I could get close to it, but the result very weird.
I'd tried other ways like adding a Toolbar
, but the result was the same.
I want a result just like Google Maps' search bar at the top. How do I do it?