Guides / Building Search UI / Getting started

Getting Started Using Widgets

Using InstantSearch Android widgets is the second layer of our API. Read about the two others possibilities in the main concepts guide.

To use a widget, once you have setup and initialized the library then all of the available widgets are directly usable in your layouts:

1
2
3
4
5
6
7
8
9
<com.algolia.instantsearch.ui.views.SearchBox
    android:id="@+id/searchBox"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" />
<com.algolia.instantsearch.ui.views.Hits
    android:id="@+id/hits"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    algolia:itemLayout="@layout/hits_item" />

Here we are using three widgets:

  • SearchBox
  • Hits
  • Stats

If you don’t initialize InstantSearch with your activity to connect your widgets, you should connect them manually with InstantSearch#registerWidget().

Did you find this page helpful?

InstantSearch Android v2