After Android studio creates a new bottomnavigationactivity, there is a blank solution in the upper area of fragment

Problem description

For example, the screenshot is as follows, which is often empty above and incomplete below (recyclerview list) (blocked by the navigation bar at the bottom)

Problem solving ideas

After switching to another fragment, it is found that it is also lower than the whole, so it should be the whole setting problem, so the problem is located to activity_ Main.xml or mobile_ In navigation. XML, which is used to specify the newly created fragment, it turns out to be an activity_ Main.xml specifies mobile_ There’s a problem with navigation’s fragment.

Problem solving

At activity_ In main.xml

    deleting the paddingtop attribute of the outermost constraintlayout will @ + ID/NAV_ host_ Layout of fragment_ Height is set to 0dp


Read More: