CoordinatorLayout causes FrameLayout to fall behind the navigation bar at the bottom












1















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?










share|improve this question























  • 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
















1















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?










share|improve this question























  • 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














1












1








1








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?










share|improve this question














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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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



















  • 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












1 Answer
1






active

oldest

votes


















1














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.






share|improve this answer
























  • @Egemen Hamutçu Did you check?

    – tm13
    Nov 18 '18 at 6:12












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
});


}
});














draft saved

draft discarded


















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









1














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.






share|improve this answer
























  • @Egemen Hamutçu Did you check?

    – tm13
    Nov 18 '18 at 6:12
















1














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.






share|improve this answer
























  • @Egemen Hamutçu Did you check?

    – tm13
    Nov 18 '18 at 6:12














1












1








1







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.






share|improve this answer













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.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 16 '18 at 10:45









tm13tm13

5981521




5981521













  • @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





@Egemen Hamutçu Did you check?

– tm13
Nov 18 '18 at 6:12




















draft saved

draft discarded




















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Florida Star v. B. J. F.

Danny Elfman

Retrieve a Users Dashboard in Tumblr with R and TumblR. Oauth Issues