Skip to content

Instantly share code, notes, and snippets.

@policante
Created March 22, 2017 20:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save policante/97fb5025301b60b2164bdc93455840a4 to your computer and use it in GitHub Desktop.
Save policante/97fb5025301b60b2164bdc93455840a4 to your computer and use it in GitHub Desktop.
Flexible toolbar and SearchView
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f2f2f2">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar_main"
android:layout_width="match_parent"
android:layout_height="@dimen/action_bar_size_x2"
android:background="@color/colorPrimary"
android:minHeight="?attr/actionBarSize" />
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="24dp"
android:layout_marginRight="24dp"
android:layout_marginBottom="16dp"
android:layout_marginTop="?attr/actionBarSize"
app:cardBackgroundColor="@android:color/white">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<SearchView
android:id="@+id/searchview"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@android:color/white" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#000000"
android:layout_marginTop="-1dp"
android:alpha="0.12"/>
</LinearLayout>
</android.support.v7.widget.CardView>
</RelativeLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment