SergeyBurlaka / CollapsingAvatarToolbarSample

An example of animation collapsing toolbar in android
https://medium.com/@anatoliy8827/how-to-animate-collapsing-avatar-toolbar-sample-f3f37ab6c35e
123 stars 17 forks source link

How to hide the solid color below the background? #1

Closed knife-s closed 5 years ago

knife-s commented 5 years ago

Hello, is there a way to hide (or change to transparent, or other color) the "orange" solid color which is below the collapsing toolbar background?

The solid color between the profile image and the collapsing background, for example.

Thank you so much, -K.

SergeyBurlaka commented 5 years ago

Hi, @knife-s ! Of course you can. delete android:tint="@color/background_Image_tint" for "@+id/main.imageview.placeholder" set android:background="@color/color_white" for "@+id/collapsing_toolbar" set true in style

I created new git branch feature, where you can find change for design.

feature/hide_solid_color_issue

Hope was helpful.

<?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:tools="http://schemas.android.com/tools"
    android:id="@+id/cl_root_content"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/app_bar_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

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

            <ImageView
                android:id="@+id/main.imageview.placeholder"
                android:layout_width="match_parent"
                android:layout_height="@dimen/top_head_background_height"
                android:scaleType="fitXY"
                android:src="@drawable/background_img"
                app:layout_collapseMode="parallax" />

            <android.support.v7.widget.Toolbar
                android:id="@+id/anim_toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

            <com.example.blogp.collapsingavatar.HeadCollapsing
                android:id="@+id/stuff_container"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:animateLayoutChanges="true">

                <TextView
                    android:id="@+id/title"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_vertical"
                    android:gravity="center"
                    android:text="Christian Bale"
                    android:textColor="@android:color/white"
                    android:textSize="14sp"
                    android:visibility="gone" />

                <de.hdodenhof.circleimageview.CircleImageView
                    android:id="@+id/imgb_avatar_wrap"
                    android:layout_width="@dimen/default_expanded_image_size"
                    android:layout_height="@dimen/default_expanded_image_size"
                    android:layout_gravity="bottom|center_horizontal"
                    android:padding="@dimen/item_decoration"
                    android:src="@drawable/avatar_img"
                    app:civ_border_color="@color/color_white"
                    app:civ_border_width="0.7dp" />

            </com.example.blogp.collapsingavatar.HeadCollapsing>

            <android.support.v7.widget.AppCompatTextView
                android:id="@+id/tv_profile_name_single"
                android:layout_width="wrap_content"
                android:layout_height="?attr/actionBarSize"
                android:layout_gravity="center_horizontal"
                android:textColor="@color/color_white"
                android:ellipsize="end"
                android:textSize="17sp"
                android:gravity="center"
                android:scrollHorizontally="true"
                android:singleLine="true"
                android:text="Christian Bale"
                android:visibility="invisible"
                app:layout_collapseMode="pin"
                tools:visibility="visible" />

            <android.support.v7.widget.AppCompatTextView
                android:id="@+id/tv_profile_name"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:layout_margin="@dimen/activity_margin"
                android:textColor="@color/color_white"
                android:ellipsize="marquee"
                android:gravity="center"
                android:maxLines="2"
                android:scrollHorizontally="true"
                app:layout_collapseMode="pin"
                android:text=" Christian Charles\n Philip Bale"
                android:textSize="24sp"
                tools:visibility="visible" />

        </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:background="@color/color_white"
        android:scrollbars="none"
        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_marginTop="8dp"
            android:layout_marginBottom="8dp"
            android:layout_marginEnd="@dimen/activity_margin"
            android:layout_marginStart="@dimen/activity_margin"
            app:cardElevation="8dp"
            app:contentPadding="16dp">

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:lineSpacingExtra="8dp"
                android:text="@string/beil_biography"
                android:textSize="18sp" />
        </android.support.v7.widget.CardView>

    </android.support.v4.widget.NestedScrollView>

</android.support.design.widget.CoordinatorLayout>
   <style name="AppTheme.NoActionBar">
        <item name="coordinatorLayoutStyle">@style/Widget.Support.CoordinatorLayout</item>
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>

        <item name="android:windowFullscreen">true</item>
    </style>