Fragment deformation in BottomNavigationActivity

Viewed 25

enter image description here

I got BottomNavigationActivity and fragment in it. My fragment seems like it has margin on it, but it doesn't. If I stretch it - top part disappears. How can I solve it?

2 Answers

That's because your ConstraintLayout has a android:paddingTop . Remove that I can't see it being necessary?

Also your fragment should have:

android:layout_width="match_parent"
android:layout_height="match_parent"

But because of your constraints I don't think the layout_width and layout_height is respected, might even be able to be 0dp you would need to test if that works for you

You are using a ConstraintLayout as Parent. There is top padding in your layout. remove the padding line from ConstraintLayout.

You set a custom height and width for the Fragment. Replace the custom size with match_parent. That will solve your problem. You can also use 0dp instead of match_parent. 0dp will automatically resize your fragment window according to the screen size.

Related