Skip to content
Advertisement

Fragment Inside a Fragment Not Working with ScrollView

When I am Using Fragment Inside a Fragment with ScrollView It is not working. In My Case the FirstFragment is fine. the fragment that is inside is not showing in full screen and lot of contents in BooksFragment are disappear

this is My FirstFragment ‘s XML :

JavaScript

</androidx.constraintlayout.widget.ConstraintLayout>

This is My FirstFragment ‘s JAVA :

JavaScript

This is My BooksFragment‘s Xml:

JavaScript

If I say this problem in simple word it would be like this :

My First Fragment is Fine but Inside Fragment’s Content is not shown so How can I fix that? Any Help Will be Appreciated. If you have any doubts or question related to my post you can tell me.

Example :

As you guys already know I have very Long text in BooksFragment ‘s Xml: but In this Images you got the Point.

In this Image even One Text is not showing

enter image description here

In this Image Text is showing because it’s text length is very small.

enter image description here

Alert:

Please Don’t Think that grey background is his (booksFragment,ComputerFragment). FirstFragment‘s Bg is Grey! not BooksFragment and ComputerFragment

Edited :

I am adding this image with different colors so you get the what’s size is what.

enter image description here

here the color definitions

  • Gray Color – MainActivity
  • Light Blue Color – FirstFragment
  • Red Color – BookFragment

Advertisement

Answer

Your Code is Working Fine but Your code have some minor mistakes so you can follow this code –

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement