0

enter image description here

Above screenshot you can see there is two images blue and pink

  1. Blue is single image it's a ImageView
  2. Pink is slider of images its FrameLayout with ViewPager

The problem is when i use ImageView then toolbar become transparent and Image set to background of toolbar for example blue image.

when I remove ImageView then it become gray and FrameLayout will not attached to background of toolbar like blue image find the screenshot below

enter image description here

here is my xml code

<?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"
android:id="@+id/coordinatorLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"

>

<android.support.design.widget.AppBarLayout
    android:fitsSystemWindows="true"
    android:stateListAnimator="@anim/appbar_always_elevated"
    android:id="@+id/appBarLayout"
    app:elevation="0dp"
    app:borderWidth="0dp"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

    <android.support.design.widget.CollapsingToolbarLayout
        android:id="@+id/collapse_toolbar"
        android:layout_width="match_parent"
        app:titleEnabled="false"
        android:layout_height="match_parent"
        app:contentScrim="?attr/colorPrimary"
        app:layout_scrollFlags="scroll|exitUntilCollapsed">
       

                <ImageView
                    android:id="@+id/backdrop"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:fitsSystemWindows="true"
                    android:scaleType="centerCrop"
                    android:src="@drawable/test"
                    app:layout_collapseMode="parallax" />

                    <FrameLayout
                        android:fitsSystemWindows="true"
                        app:layout_collapseMode="parallax"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent">


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


                    </FrameLayout>




        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:minHeight="?attr/actionBarSize"
            app:layout_collapseMode="pin"
            app:popupTheme="@style/AppTheme.AppBarOverlay"
            app:titleMarginTop="15dp" />


    </android.support.design.widget.CollapsingToolbarLayout>



</android.support.design.widget.AppBarLayout>



</android.support.design.widget.CoordinatorLayout>

layout_slider.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/view_slider_layout"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<FrameLayout
    app:layout_collapseMode="parallax"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.v4.view.ViewPager
        android:id="@+id/slider_view_pager"
        android:layout_width="match_parent"
        android:layout_height="@dimen/slider_height">

    </android.support.v4.view.ViewPager>


    <LinearLayout
        android:orientation="vertical"
        android:layout_gravity="bottom|center"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <LinearLayout
            android:visibility="gone"
            android:gravity="center"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <TextView
                android:padding="5dip"
                android:background="@drawable/rounded_rect_gray"
                android:textColor="@color/white"
                android:textSize="@dimen/text_very_small"
                android:text="Published Apps and Courses"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

        </LinearLayout>

        <LinearLayout
            android:layout_gravity="center|center"
            android:orientation="horizontal"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">

            <me.relex.circleindicator.CircleIndicator
                android:id="@+id/indicator"
                android:layout_width="match_parent"
                android:layout_height="38dp"/>

        </LinearLayout>

    </LinearLayout>



</FrameLayout>


</LinearLayout>

I don't want blue image. I showed you just for example if I use ImageView then it's attaching to background of toolbar when I use other view it's not

Please help

Community
  • 1
  • 1
Munish Kapoor
  • 3,141
  • 2
  • 26
  • 41

0 Answers0