Scrolling 2 fragment (one Fragment and one ListFra

2019-08-14 02:58发布

I have 2 complex fragments (one Fragment and, below it, one ListFragment) in an activity and I want to be able to scroll the entire screen so I can see the rest of the list content. I've tried putting the 2 fragments inside a ScrollView and it does scroll but the list fragment only shows the first row. After that, I keep scrolling but the screen is empty (shows no other list rows).

Anyone know what the problem is and/or how to solve it?

1条回答
Luminary・发光体
2楼-- · 2019-08-14 03:12

Set first Fragment as a header of ListView in the second Fragment.

mySecondFragment.getListView().addHeaderView(containerOfFirstFragment).

Where containerOfFirstFragment is a View (layout) containg 1st Fragment.

Maybe there is a possibility to add header view another way, but I don't seek it.

查看更多
登录 后发表回答