Open deshario opened 7 years ago
i use it like this <FrameLayout android:id="@+id/toolbar_container" android:layout_width="match_parent" android:orientation="vertical" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" android:layout_alignParentStart="true">
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#68b653"
android:theme="@style/ThemeOverlay.AppCompat.Dark">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/help"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:src="@drawable/drawer" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:gravity="center"
android:text="Map"
android:textColor="#ffffff"
android:textSize="18sp" />
</RelativeLayout>
</android.support.v7.widget.Toolbar>
<com.miguelcatalan.materialsearchview.MaterialSearchView
android:id="@+id/search_view"
android:layout_width="match_parent"
android:hint="Search for an Art Piece or Artist's Name"
android:visibility="gone"
style="@style/MaterialSearchViewStyle"
android:layout_height="wrap_content"
/>
</FrameLayout>
Above has right answer, wrap it in FrameLayout.
How to show MaterialSearchView inside Toolbar when we tap searchicon from toolbar! Can i replace all things in toolbar with materialsearchview when searchView.openSearch() is triggered !
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto" android:orientation="vertical">