user2759617
user2759617

Reputation: 707

set background for activity containing AppbBarLayout

I am trying to use androids CoordinatorLayout and FrameLayout. What I want to have is a toolbar LinearLayout showing some info tablayout listviews

when the listviews are scrolled the toolbar and the LinearLayouts should scrollup and hide and the tabs should go at the top.

I have a layout of the type:

<android.support.v4.widget.DrawerLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true">

    <android.support.design.widget.CoordinatorLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:tools="http://schemas.android.com/tools"
            xmlns:app="http://schemas.android.com/apk/res-auto"
            android:id="@+id/coordinatorLayout"
            android:layout_height="match_parent"
            android:layout_width="match_parent">

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

        <-- stuff I want to hide on scrolling -->
            <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    app:layout_scrollFlags="scroll|enterAlways"
                    android:orientation="vertical">

                <include
                        layout="@layout/toolbar"
                        app:layout_scrollFlags="scroll|enterAlways"/>

                <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        app:layout_scrollFlags="scroll|enterAlways"
                        android:orientation="vertical">
                    <TextView
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:text="Gamercard content"
                            />
                    <TextView
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:text="More Gamercard content"
                            />
                </LinearLayout>

            </LinearLayout>

            <-- stuff I dont want to hide on scrolling -->

            <android.support.design.widget.TabLayout
                    android:id="@+id/tabLayout"
                    android:scrollbars="horizontal"
                    android:layout_below="@+id/toolbar"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"/>


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

        <!-- My Scrollable View -->
        <include layout="@layout/nested_scrolling_container_view"/>

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

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

What I want to do is have a picture as the background for the entire activity, but what I see is that the AppBarLayout part is always dark. Please help.

Upvotes: 0

Views: 490

Answers (1)

user2759617
user2759617

Reputation: 707

I could do it programmatically by setting the backgroundColor in code to Color.TRANSPARENT.

appbar.setBackgroundColor(Color.TRANSPARENT);

Upvotes: 0

Related Questions