Skip to content

Instantly share code, notes, and snippets.

@communikein
Last active December 28, 2017 10:28
Show Gist options
  • Save communikein/9200bd6ae20ee005e9924bba8b9540da to your computer and use it in GitHub Desktop.
Save communikein/9200bd6ae20ee005e9924bba8b9540da to your computer and use it in GitHub Desktop.
Main layout with data binding. It includes a secondary layout and pass to it a variable.
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:bind="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="mainUser"
type="it.communikein.myunimib.User" />
</data>
<android.support.design.widget.CoordinatorLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="@dimen/app_bar_height"
android:fitsSystemWindows="true"
android:theme="@style/Theme.MyUnimib.AppBarOverlay">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/toolbar_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:toolbarId="@+id/toolbar">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="@style/Theme.MyUnimib.PopupOverlay" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<include android:id="@+id/secondary"
layout="@layout/data_binding_included_secondary_layout"
bind:secondaryUser="@{mainUser}"/>
</android.support.design.widget.CoordinatorLayout>
</layout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment