Skip to content

Instantly share code, notes, and snippets.

@valentineRutto
Created November 14, 2018 10:42
Show Gist options
  • Save valentineRutto/bafbdda9fa9848111a6aa6f505e83eaa to your computer and use it in GitHub Desktop.
Save valentineRutto/bafbdda9fa9848111a6aa6f505e83eaa to your computer and use it in GitHub Desktop.
card overlapping views
<xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 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.support.design.widget.AppBarLayout
android:id="@+id/appBar"
android:layout_width="match_parent"
android:layout_height="250dp"
>
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/toolbarlayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/quotes"
android:scaleType="centerCrop"/>
<android.support.v7.widget.Toolbar
android:id="@+id/tool"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="parallax"/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorWhite"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
/>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_marginRight="32dp"
android:layout_marginLeft="32dp"
app:layout_anchor="@id/appBar"
app:layout_anchorGravity="bottom|center"
app:cardElevation="@dimen/small_padding"
/>
</android.support.design.widget.CoordinatorLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment