Skip to content

Instantly share code, notes, and snippets.

@nowke
Created September 26, 2015 07:41
Show Gist options
  • Save nowke/9de9969049ce5142732e to your computer and use it in GitHub Desktop.
Save nowke/9de9969049ce5142732e to your computer and use it in GitHub Desktop.
Detail Activity layout - Sticky scroll view
<com.emilsjolander.components.StickyScrollViewItems.StickyScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="196dp"
android:layout_alignParentTop="true"
android:scaleType="centerCrop"
android:src="@drawable/back" />
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_below="@id/imageView"
android:background="@color/colorPrimary"
android:fitsSystemWindows="true"
android:tag="sticky"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:contentInsetLeft="72dp"
app:contentInsetStart="72dp"
app:layout_collapseMode="pin"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:theme="@style/toolbar_theme" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="72dp"
android:layout_marginRight="16dp"
android:text="@string/event_title"
android:textColor="@color/colorTextAppbar"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="72dp"
android:layout_marginRight="16dp"
android:text="@string/event_time"
android:textColor="@color/colorTextAppbar"
android:textSize="14sp" />
</android.support.design.widget.AppBarLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/appbar"
android:orientation="vertical"
android:paddingRight="16dp"
android:paddingTop="16dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="32dp"
android:layout_marginLeft="72dp"
android:lineSpacingExtra="4dp"
android:text="@string/longText1"
android:textColor="@color/colorText" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="32dp"
android:layout_marginLeft="72dp"
android:lineSpacingExtra="4dp"
android:text="@string/longText2"
android:textColor="@color/colorText" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginLeft="72dp"
android:text="@string/titleSpeakers"
android:textColor="@color/colorTextAppbar"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="72dp"
android:orientation="horizontal">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:scaleType="centerCrop"
android:src="@drawable/avatar" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lineSpacingExtra="4dp"
android:text="@string/speakerName"
android:textColor="@color/colorText"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lineSpacingExtra="4dp"
android:text="@string/speakerBio"
android:textColor="@color/colorText" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</com.emilsjolander.components.StickyScrollViewItems.StickyScrollView>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment