CollapsingToolbarLayout | Four Layouts inside | First Two Scrollable & Last Two Fixed
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I got a little different requirement related to CollapsingToolbarLayout scrolling. I played with all scrollFlags and collapseMode but no combination worked for me.
Please help me to achieve this requirement.
What I need to implement:
I need to implement an AppBarLayout inside which four views will be placed.
- Toolbar (Fixed)
- LinearLayout (Fixed)
- LinearLayout (Scrollable)
- TabLayout (Scrollable)
Content is a recyclerview. For reference I am attaching an screenshot. As you can see in screen, toolbar and layout with red background need to be fixed. And layout with green and blue background need to be scrollable when recyclerview is scrolled up.
I am able to fix toolbar and remaining views scrollable. But not able to fix toolbar and layout with red background. Please help me in this.
Below is my my layout xml-
<?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:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/collapsing_toolbar_appbarlayout"
android:layout_width="match_parent"
android:layout_height="208dp"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:titleEnabled="false">
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="56dp"
android:layout_gravity="bottom"
android:layout_marginTop="160dp"
android:background="#0000ff"
app:layout_collapseMode="none"
app:tabGravity="fill"
app:tabIndicatorColor="#ffffff"
app:tabIndicatorHeight="4dp"
app:tabMode="fixed" />
<LinearLayout
android:id="@+id/title_container1"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginTop="104dp"
android:orientation="vertical"
app:layout_collapseMode="none">
<android.support.v7.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="#00ff00"
android:gravity="center"
android:text="test"
android:textColor="#000000" />
</LinearLayout>
<LinearLayout
android:id="@+id/title_container"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginTop="56dp"
android:orientation="vertical"
app:layout_collapseMode="pin">
<android.support.v7.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ff0000"
android:gravity="center"
android:text="test"
android:textColor="#000000" />
</LinearLayout>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="56dp"
android:background="@color/colorPrimary"
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
app:layout_collapseMode="pin"
app:popupTheme="@style/AppTheme.PopupOverlay"
app:titleTextColor="#ffffff" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/collapsing_toolbar_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/collapsing_toolbar_floating_action_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="19dp"
android:src="@drawable/calendar"
app:layout_anchor="@id/collapsing_toolbar_recycler_view"
app:layout_anchorGravity="bottom|end" />
</android.support.design.widget.CoordinatorLayout>


add a comment |
I got a little different requirement related to CollapsingToolbarLayout scrolling. I played with all scrollFlags and collapseMode but no combination worked for me.
Please help me to achieve this requirement.
What I need to implement:
I need to implement an AppBarLayout inside which four views will be placed.
- Toolbar (Fixed)
- LinearLayout (Fixed)
- LinearLayout (Scrollable)
- TabLayout (Scrollable)
Content is a recyclerview. For reference I am attaching an screenshot. As you can see in screen, toolbar and layout with red background need to be fixed. And layout with green and blue background need to be scrollable when recyclerview is scrolled up.
I am able to fix toolbar and remaining views scrollable. But not able to fix toolbar and layout with red background. Please help me in this.
Below is my my layout xml-
<?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:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/collapsing_toolbar_appbarlayout"
android:layout_width="match_parent"
android:layout_height="208dp"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:titleEnabled="false">
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="56dp"
android:layout_gravity="bottom"
android:layout_marginTop="160dp"
android:background="#0000ff"
app:layout_collapseMode="none"
app:tabGravity="fill"
app:tabIndicatorColor="#ffffff"
app:tabIndicatorHeight="4dp"
app:tabMode="fixed" />
<LinearLayout
android:id="@+id/title_container1"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginTop="104dp"
android:orientation="vertical"
app:layout_collapseMode="none">
<android.support.v7.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="#00ff00"
android:gravity="center"
android:text="test"
android:textColor="#000000" />
</LinearLayout>
<LinearLayout
android:id="@+id/title_container"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginTop="56dp"
android:orientation="vertical"
app:layout_collapseMode="pin">
<android.support.v7.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ff0000"
android:gravity="center"
android:text="test"
android:textColor="#000000" />
</LinearLayout>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="56dp"
android:background="@color/colorPrimary"
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
app:layout_collapseMode="pin"
app:popupTheme="@style/AppTheme.PopupOverlay"
app:titleTextColor="#ffffff" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/collapsing_toolbar_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/collapsing_toolbar_floating_action_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="19dp"
android:src="@drawable/calendar"
app:layout_anchor="@id/collapsing_toolbar_recycler_view"
app:layout_anchorGravity="bottom|end" />
</android.support.design.widget.CoordinatorLayout>


add a comment |
I got a little different requirement related to CollapsingToolbarLayout scrolling. I played with all scrollFlags and collapseMode but no combination worked for me.
Please help me to achieve this requirement.
What I need to implement:
I need to implement an AppBarLayout inside which four views will be placed.
- Toolbar (Fixed)
- LinearLayout (Fixed)
- LinearLayout (Scrollable)
- TabLayout (Scrollable)
Content is a recyclerview. For reference I am attaching an screenshot. As you can see in screen, toolbar and layout with red background need to be fixed. And layout with green and blue background need to be scrollable when recyclerview is scrolled up.
I am able to fix toolbar and remaining views scrollable. But not able to fix toolbar and layout with red background. Please help me in this.
Below is my my layout xml-
<?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:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/collapsing_toolbar_appbarlayout"
android:layout_width="match_parent"
android:layout_height="208dp"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:titleEnabled="false">
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="56dp"
android:layout_gravity="bottom"
android:layout_marginTop="160dp"
android:background="#0000ff"
app:layout_collapseMode="none"
app:tabGravity="fill"
app:tabIndicatorColor="#ffffff"
app:tabIndicatorHeight="4dp"
app:tabMode="fixed" />
<LinearLayout
android:id="@+id/title_container1"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginTop="104dp"
android:orientation="vertical"
app:layout_collapseMode="none">
<android.support.v7.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="#00ff00"
android:gravity="center"
android:text="test"
android:textColor="#000000" />
</LinearLayout>
<LinearLayout
android:id="@+id/title_container"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginTop="56dp"
android:orientation="vertical"
app:layout_collapseMode="pin">
<android.support.v7.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ff0000"
android:gravity="center"
android:text="test"
android:textColor="#000000" />
</LinearLayout>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="56dp"
android:background="@color/colorPrimary"
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
app:layout_collapseMode="pin"
app:popupTheme="@style/AppTheme.PopupOverlay"
app:titleTextColor="#ffffff" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/collapsing_toolbar_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/collapsing_toolbar_floating_action_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="19dp"
android:src="@drawable/calendar"
app:layout_anchor="@id/collapsing_toolbar_recycler_view"
app:layout_anchorGravity="bottom|end" />
</android.support.design.widget.CoordinatorLayout>


I got a little different requirement related to CollapsingToolbarLayout scrolling. I played with all scrollFlags and collapseMode but no combination worked for me.
Please help me to achieve this requirement.
What I need to implement:
I need to implement an AppBarLayout inside which four views will be placed.
- Toolbar (Fixed)
- LinearLayout (Fixed)
- LinearLayout (Scrollable)
- TabLayout (Scrollable)
Content is a recyclerview. For reference I am attaching an screenshot. As you can see in screen, toolbar and layout with red background need to be fixed. And layout with green and blue background need to be scrollable when recyclerview is scrolled up.
I am able to fix toolbar and remaining views scrollable. But not able to fix toolbar and layout with red background. Please help me in this.
Below is my my layout xml-
<?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:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/collapsing_toolbar_appbarlayout"
android:layout_width="match_parent"
android:layout_height="208dp"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:titleEnabled="false">
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="56dp"
android:layout_gravity="bottom"
android:layout_marginTop="160dp"
android:background="#0000ff"
app:layout_collapseMode="none"
app:tabGravity="fill"
app:tabIndicatorColor="#ffffff"
app:tabIndicatorHeight="4dp"
app:tabMode="fixed" />
<LinearLayout
android:id="@+id/title_container1"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginTop="104dp"
android:orientation="vertical"
app:layout_collapseMode="none">
<android.support.v7.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="#00ff00"
android:gravity="center"
android:text="test"
android:textColor="#000000" />
</LinearLayout>
<LinearLayout
android:id="@+id/title_container"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginTop="56dp"
android:orientation="vertical"
app:layout_collapseMode="pin">
<android.support.v7.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ff0000"
android:gravity="center"
android:text="test"
android:textColor="#000000" />
</LinearLayout>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="56dp"
android:background="@color/colorPrimary"
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
app:layout_collapseMode="pin"
app:popupTheme="@style/AppTheme.PopupOverlay"
app:titleTextColor="#ffffff" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/collapsing_toolbar_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/collapsing_toolbar_floating_action_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="19dp"
android:src="@drawable/calendar"
app:layout_anchor="@id/collapsing_toolbar_recycler_view"
app:layout_anchorGravity="bottom|end" />
</android.support.design.widget.CoordinatorLayout>




edited Jan 3 at 6:29
user320676
asked Jan 3 at 6:12
user320676user320676
248115
248115
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54017158%2fcollapsingtoolbarlayout-four-layouts-inside-first-two-scrollable-last-two%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54017158%2fcollapsingtoolbarlayout-four-layouts-inside-first-two-scrollable-last-two%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown