Skip to main content
adicionou 1328 caracteres ao conteúdo
Fonte Link
<android.support.design.widget.CoordinatorLayout android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
>
<android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="@dimen/height_CollapsingToolbarLayout"
        android:id="@+id/appBar"
        android:fitsSystemWindows="true"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
 
        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/collapsing_toolbar"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:contentScrim="@color/colorPrimary"
            app:layout_scrollFlags="scroll|exitUntilCollapsed">

       <ImageView
     <ImageView
       android:id="@+id/ivPerfilCl"
            android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:scaleType="centerCrop"
                android:background="@drawablesrc="@drawable/suaimage"logo"
            app:layout_behavior="@string/appbar_scrolling_view_behavior"

         app:layout_collapseMode="parallax"   />
       
        <android.support.v7.widget.Toolbar
            android:id="@+id/tbDetalhes"
            android:layout_width="match_parent"
            app:layout_collapseMode="pin"
            app:layout_collapseMode="pin"theme="@style/toobar"
            app:layout_scrollFlags="scroll|enterAlways"
            android:layout_height="?attr/actionBarSize"
                android:minHeight="?attr/actionBarSize"
            />

    </>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:id="@+id/nested"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">

</android.support.v4.widget.NestedScrollView>
<android.support.design.widget.CollapsingToolbarLayout>FloatingActionButton
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    app:borderWidth="0dp"
    android:src="@drawable/ic_event_available_white_24dp"
    app:layout_anchor="@id/appBar"
    app:layout_anchorGravity="bottom|right|end"
    android:elevation="2dp"
    android:layout_marginRight="16dp"
    android:id="@+id/FABParticiparDaAtividade"
    app:fabSize="normal"
    />
</android.support.design.widget.AppBarLayout>CoordinatorLayout>

No meu funciona. Tenha certeza de coloca-lo dentro de um CoordinatorLayoutOlha como ficou. inserir a descrição da imagem aqui

<android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="@dimen/height_CollapsingToolbarLayout"
        android:id="@+id/appBar"
        android:fitsSystemWindows="true"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
 
        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/collapsing_toolbar"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:contentScrim="@color/colorPrimary"
            app:layout_scrollFlags="scroll|exitUntilCollapsed">

            <ImageView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:scaleType="centerCrop"
                android:background="@drawable/suaimage"
                app:layout_collapseMode="parallax"/>
            <android.support.v7.widget.Toolbar
                android:layout_width="match_parent"
                app:layout_collapseMode="pin"
                android:layout_height="?attr/actionBarSize"
                android:minHeight="?attr/actionBarSize"
                />
        </android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>

No meu funciona. Tenha certeza de coloca-lo dentro de um CoordinatorLayout.

<android.support.design.widget.CoordinatorLayout android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
>
<android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="@dimen/height_CollapsingToolbarLayout"
    android:id="@+id/appBar"
    android:fitsSystemWindows="true"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
    <android.support.design.widget.CollapsingToolbarLayout
        android:id="@+id/collapsing_toolbar"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:contentScrim="@color/colorPrimary"
        app:layout_scrollFlags="scroll|exitUntilCollapsed">

       <ImageView
            android:id="@+id/ivPerfilCl"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:scaleType="centerCrop"
            android:src="@drawable/logo"
            app:layout_behavior="@string/appbar_scrolling_view_behavior"

            />
       
        <android.support.v7.widget.Toolbar
            android:id="@+id/tbDetalhes"
            android:layout_width="match_parent"
            app:layout_collapseMode="pin"
            app:theme="@style/toobar"
            app:layout_scrollFlags="scroll|enterAlways"
            android:layout_height="?attr/actionBarSize"
            android:minHeight="?attr/actionBarSize"
            />

    </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:id="@+id/nested"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">

</android.support.v4.widget.NestedScrollView>
<android.support.design.widget.FloatingActionButton
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    app:borderWidth="0dp"
    android:src="@drawable/ic_event_available_white_24dp"
    app:layout_anchor="@id/appBar"
    app:layout_anchorGravity="bottom|right|end"
    android:elevation="2dp"
    android:layout_marginRight="16dp"
    android:id="@+id/FABParticiparDaAtividade"
    app:fabSize="normal"
    />
</android.support.design.widget.CoordinatorLayout>

No meu funciona. Olha como ficou. inserir a descrição da imagem aqui

Fonte Link

Use esse:

<android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="@dimen/height_CollapsingToolbarLayout"
        android:id="@+id/appBar"
        android:fitsSystemWindows="true"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/collapsing_toolbar"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:contentScrim="@color/colorPrimary"
            app:layout_scrollFlags="scroll|exitUntilCollapsed">

            <ImageView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:scaleType="centerCrop"
                android:background="@drawable/suaimage"
                app:layout_collapseMode="parallax"/>
            <android.support.v7.widget.Toolbar
                android:layout_width="match_parent"
                app:layout_collapseMode="pin"
                android:layout_height="?attr/actionBarSize"
                android:minHeight="?attr/actionBarSize"
                />
        </android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>

No meu funciona. Tenha certeza de coloca-lo dentro de um CoordinatorLayout.