CoordinatorLayout causes FrameLayout to fall behind the navigation bar at the bottom
This is my activity 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:background="@android:color/white"
android:fitsSystemWindows="true">
<include layout="@layout/toolbar" />
<FrameLayout
android:id="@+id/frameLayoutContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
I replace frameLayoutContainer
with a ConstraintLayout-rooted Fragment. It has a Button view at the bottom constrained with app:layout_constraintBottom_toBottomOf="parent"
But the Button view falls behind the navigation bar. I have many activities almost the same structure with this, but they don't have such a problem.
When I replace CoordinatorLayout with a LinearLayout, the problem is solved, but I want to know what is wrong with CoordinatorLayout?
android android-coordinatorlayout android-support-design coordinator-layout
add a comment |
This is my activity 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:background="@android:color/white"
android:fitsSystemWindows="true">
<include layout="@layout/toolbar" />
<FrameLayout
android:id="@+id/frameLayoutContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
I replace frameLayoutContainer
with a ConstraintLayout-rooted Fragment. It has a Button view at the bottom constrained with app:layout_constraintBottom_toBottomOf="parent"
But the Button view falls behind the navigation bar. I have many activities almost the same structure with this, but they don't have such a problem.
When I replace CoordinatorLayout with a LinearLayout, the problem is solved, but I want to know what is wrong with CoordinatorLayout?
android android-coordinatorlayout android-support-design coordinator-layout
Which style did you apply to this activity?
– Rade
Nov 16 '18 at 8:24
And one more think, try removing android:fitsSystemWindows="true" from your root layout element.
– Rade
Nov 16 '18 at 8:25
add a comment |
This is my activity 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:background="@android:color/white"
android:fitsSystemWindows="true">
<include layout="@layout/toolbar" />
<FrameLayout
android:id="@+id/frameLayoutContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
I replace frameLayoutContainer
with a ConstraintLayout-rooted Fragment. It has a Button view at the bottom constrained with app:layout_constraintBottom_toBottomOf="parent"
But the Button view falls behind the navigation bar. I have many activities almost the same structure with this, but they don't have such a problem.
When I replace CoordinatorLayout with a LinearLayout, the problem is solved, but I want to know what is wrong with CoordinatorLayout?
android android-coordinatorlayout android-support-design coordinator-layout
This is my activity 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:background="@android:color/white"
android:fitsSystemWindows="true">
<include layout="@layout/toolbar" />
<FrameLayout
android:id="@+id/frameLayoutContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
I replace frameLayoutContainer
with a ConstraintLayout-rooted Fragment. It has a Button view at the bottom constrained with app:layout_constraintBottom_toBottomOf="parent"
But the Button view falls behind the navigation bar. I have many activities almost the same structure with this, but they don't have such a problem.
When I replace CoordinatorLayout with a LinearLayout, the problem is solved, but I want to know what is wrong with CoordinatorLayout?
android android-coordinatorlayout android-support-design coordinator-layout
android android-coordinatorlayout android-support-design coordinator-layout
asked Nov 16 '18 at 8:16
Egemen HamutçuEgemen Hamutçu
45621227
45621227
Which style did you apply to this activity?
– Rade
Nov 16 '18 at 8:24
And one more think, try removing android:fitsSystemWindows="true" from your root layout element.
– Rade
Nov 16 '18 at 8:25
add a comment |
Which style did you apply to this activity?
– Rade
Nov 16 '18 at 8:24
And one more think, try removing android:fitsSystemWindows="true" from your root layout element.
– Rade
Nov 16 '18 at 8:25
Which style did you apply to this activity?
– Rade
Nov 16 '18 at 8:24
Which style did you apply to this activity?
– Rade
Nov 16 '18 at 8:24
And one more think, try removing android:fitsSystemWindows="true" from your root layout element.
– Rade
Nov 16 '18 at 8:25
And one more think, try removing android:fitsSystemWindows="true" from your root layout element.
– Rade
Nov 16 '18 at 8:25
add a comment |
1 Answer
1
active
oldest
votes
The line app:layout_behavior="@string/appbar_scrolling_view_behavior"
does all the job. Try to remove this line from your XML file and you will see that the problem happens even if you do not replace frameLayoutContainer
with Fragment
.
Thus, the solution is to add this line app:layout_behavior="@string/appbar_scrolling_view_behavior"
to your root of Fragment (either in your XML or programmatically) and check it.
@Egemen Hamutçu Did you check?
– tm13
Nov 18 '18 at 6:12
add a comment |
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%2f53333870%2fcoordinatorlayout-causes-framelayout-to-fall-behind-the-navigation-bar-at-the-bo%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The line app:layout_behavior="@string/appbar_scrolling_view_behavior"
does all the job. Try to remove this line from your XML file and you will see that the problem happens even if you do not replace frameLayoutContainer
with Fragment
.
Thus, the solution is to add this line app:layout_behavior="@string/appbar_scrolling_view_behavior"
to your root of Fragment (either in your XML or programmatically) and check it.
@Egemen Hamutçu Did you check?
– tm13
Nov 18 '18 at 6:12
add a comment |
The line app:layout_behavior="@string/appbar_scrolling_view_behavior"
does all the job. Try to remove this line from your XML file and you will see that the problem happens even if you do not replace frameLayoutContainer
with Fragment
.
Thus, the solution is to add this line app:layout_behavior="@string/appbar_scrolling_view_behavior"
to your root of Fragment (either in your XML or programmatically) and check it.
@Egemen Hamutçu Did you check?
– tm13
Nov 18 '18 at 6:12
add a comment |
The line app:layout_behavior="@string/appbar_scrolling_view_behavior"
does all the job. Try to remove this line from your XML file and you will see that the problem happens even if you do not replace frameLayoutContainer
with Fragment
.
Thus, the solution is to add this line app:layout_behavior="@string/appbar_scrolling_view_behavior"
to your root of Fragment (either in your XML or programmatically) and check it.
The line app:layout_behavior="@string/appbar_scrolling_view_behavior"
does all the job. Try to remove this line from your XML file and you will see that the problem happens even if you do not replace frameLayoutContainer
with Fragment
.
Thus, the solution is to add this line app:layout_behavior="@string/appbar_scrolling_view_behavior"
to your root of Fragment (either in your XML or programmatically) and check it.
answered Nov 16 '18 at 10:45
tm13tm13
5981521
5981521
@Egemen Hamutçu Did you check?
– tm13
Nov 18 '18 at 6:12
add a comment |
@Egemen Hamutçu Did you check?
– tm13
Nov 18 '18 at 6:12
@Egemen Hamutçu Did you check?
– tm13
Nov 18 '18 at 6:12
@Egemen Hamutçu Did you check?
– tm13
Nov 18 '18 at 6:12
add a comment |
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%2f53333870%2fcoordinatorlayout-causes-framelayout-to-fall-behind-the-navigation-bar-at-the-bo%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
Which style did you apply to this activity?
– Rade
Nov 16 '18 at 8:24
And one more think, try removing android:fitsSystemWindows="true" from your root layout element.
– Rade
Nov 16 '18 at 8:25