I am trying to implement searchview on my activity. But whenever I am using framelayout to contain toolbar and searchview, I am getting error of "android.widget.FrameLayout cannot be cast to androidx.appcompat.widget.Toolbar"
<FrameLayout android:id="@+id/toolbar_container" android:layout_width="match_parent" android:layout_height="wrap_content"> <androidx.appcompat.widget.Toolbar android:id="@+id/search_toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" app:popupTheme="@style/AppTheme.PopupOverlay" xmlns:android="http://schemas.android.com/apk/res/android" android:elevation="4dp" android:fitsSystemWindows="true" xmlns:app="http://schemas.android.com/apk/res-auto"> </androidx.appcompat.widget.Toolbar> <com.miguelcatalan.materialsearchview.MaterialSearchView android:id="@+id/search_view" android:layout_width="match_parent" android:layout_height="wrap_content" /> </FrameLayout>
2.1m questions
2.1m answers
60 comments
57.0k users