0

I have an activity that is a NestedScrollView, this scrollview contains a TableLayout.

The TableLayout's amount of content never changes, meaning it always has 15 TableRows.

However, I set some of the TableRows to be INVISIBLE, if there is no content for them currently.

The TableLayout is supposed to display currently connected Devices, and information about them.

If only 5 devices are connected only the first 5 TableRows will be visible and filled with content.

However, when the user goes to scroll it scrolls down past a lot of "white space" where the other 10 TableRows would be, but they are invisible.

Is there a way to tell the NestedScrollView to stop scrolling at the last visible view?

Dylan Holmes
  • 335
  • 1
  • 6
  • 17

2 Answers2

1

Try to set the rows to :

 View.GONE

not :

View.INVISIBLE
Ro Ra
  • 265
  • 2
  • 8
0

Create the table programmatically. This way the rows will only exist when there is content and you won't have this problem.

Here is an example of how to do that: Create TableLayout programmatically

Community
  • 1
  • 1
Michael Vescovo
  • 3,741
  • 4
  • 32
  • 45