1

I'm using material designing collepsingToolbarLayout inside appbar with coordinatorLayout

My first question is i need to add subtitle with title like toolbar but there is no override for set subtitle in Collepsingtoolbarlayout layout. My second question is it should be collapse with title like whats app user profile activity. I just need to design it custom according to needs.

my code is here

<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="@dimen/profile_header_height"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">

<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginEnd="16dp"
app:expandedTitleMarginStart="20dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_collapseMode="parallax">

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/mainView"
        android:layout_width="match_parent"
        android:layout_height="@dimen/profile_header_height"
        android:background="@color/colorPrimary"
        >
        <ImageView
            android:id="@+id/ivAvatar"
            android:layout_width="@dimen/appbar_profile_pic_height_width"
            android:layout_height="@dimen/appbar_profile_pic_height_width"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="@dimen/profile_header_margin_top"
            android:layout_marginLeft="?android:attr/listPreferredItemPaddingLeft"
            android:contentDescription="@string/userPictureDes"
            android:src="@drawable/ic_user_circle_white" />
        <TextView
            android:id="@+id/text_name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:singleLine="true"
            android:text="@string/example_user_name"
            android:layout_centerHorizontal="true"
            android:layout_below="@+id/ivAvatar"
            android:layout_marginBottom="@dimen/list_text_padding_top"
            android:layout_marginTop="5dp"
            android:textColor="@android:color/white"
            android:textSize="@dimen/profile_name_text_size" />
    </RelativeLayout>
</FrameLayout>
<android.support.v7.widget.Toolbar
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:layout_gravity="top"
    app:layout_collapseMode="pin"
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

image and text inside collepsingToolbarLayout should to collapse with animation and set text_name as title like whats app that is mentioned above

JosephM
  • 2,935
  • 4
  • 18
  • 28

0 Answers0