Snippets

Rahul Upadhyay Coordinator Layout for Profile

Created by Rahul Upadhyay
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:fresco="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/clProfile"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/app_bar_profile"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fitsSystemWindows="true"
        android:theme="@style/AppTheme.AppBarOverlay">

        <android.support.design.widget.CollapsingToolbarLayout
            android:fitsSystemWindows="true"
            android:id="@+id/toolbar_layout"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:contentScrim="?attr/colorPrimary"
            app:layout_scrollFlags="scroll|exitUntilCollapsed"
            app:expandedTitleTextAppearance="@style/TransparentTextToolbar"
            >

            <com.facebook.drawee.view.SimpleDraweeView
                android:id="@+id/imgProfilePic"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:adjustViewBounds="true"
                android:clickable="true"
                android:fitsSystemWindows="true"
                android:foreground="?attr/selectableItemBackground"
                app:layout_collapseMode="parallax"
                fresco:actualImageScaleType="focusCrop"
                fresco:fadeDuration="300"
                fresco:placeholderImage="@mipmap/ic_launcher_round" />

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbarProfile"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:layout_collapseMode="pin"
                app:layout_scrollFlags="scroll|exitUntilCollapsed"
                app:popupTheme="@style/AppTheme.PopupOverlay"
                />
        </android.support.design.widget.CollapsingToolbarLayout>
    </android.support.design.widget.AppBarLayout>

    <include layout="@layout/content_profile" />



    <android.support.design.widget.FloatingActionButton
        android:visibility="gone"
        android:id="@+id/fabSaveProfile"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="@dimen/fab_margin"
        app:layout_anchor="@id/app_bar_profile"
        app:layout_anchorGravity="bottom|end"
        app:srcCompat="@drawable/ic_save_white_24dp" />

</android.support.design.widget.CoordinatorLayout>
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:fresco="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scrollbars="none"
    app:behavior_overlapTop="@dimen/DP_64"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">

    <android.support.v7.widget.CardView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="8dp"
        app:cardCornerRadius="@dimen/DP_4"
        app:cardElevation="8dp"
        app:contentPadding="16dp">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <FrameLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal">

                <com.facebook.drawee.view.SimpleDraweeView
                    android:id="@+id/imgProfileSmall"
                    android:layout_width="@dimen/image_width"
                    android:layout_height="@dimen/image_width"
                    android:layout_gravity="center_horizontal"
                    fresco:actualImageScaleType="focusCrop"
                    fresco:fadeDuration="300"
                    fresco:placeholderImage="@mipmap/ic_launcher_round"
                    fresco:roundAsCircle="true" />

                <android.support.v7.widget.AppCompatImageView
                    android:id="@+id/imgEditPhoto"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="bottom|right"
                    android:background="@drawable/rounded_bg"
                    android:padding="@dimen/default_margin"
                    app:srcCompat="@drawable/ic_photo_camera_white_18dp" />

            </FrameLayout>

            <com.rengwuxian.materialedittext.MaterialEditText
                android:id="@+id/edtProfileName"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="@dimen/default_margin"
                android:hint="@string/hint_name"
                android:inputType="textPersonName"
                android:lines="1"
                app:met_floatingLabel="highlight" />

            <com.rengwuxian.materialedittext.MaterialEditText
                android:id="@+id/edtProfileUserName"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="@dimen/default_margin"
                android:enabled="false"
                android:hint="@string/hint_username"
                android:lines="1"
                app:met_floatingLabel="highlight" />

            <com.rengwuxian.materialedittext.MaterialEditText
                android:id="@+id/edtProfileEmail"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="@dimen/default_margin"
                android:enabled="false"
                android:hint="@string/hint_email"
                android:inputType="textEmailAddress"
                android:lines="1"
                app:met_floatingLabel="highlight" />

        </LinearLayout>
    </android.support.v7.widget.CardView>
</android.support.v4.widget.NestedScrollView>
<resources>

        <!-- ..rest app themes... -->
            <!-- ..-->
        
    <!-- Appbar theme -->
    <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

    <!-- Toolbar theme -->
    <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

    <!-- CollapsingToolbarLayout's expandedTitleTextAppearance style -->
    <style name="TransparentTextToolbar" parent="@android:style/TextAppearance">
        <item name="android:textColor">#00666666</item>
    </style>

</resources>

Comments (2)