views:

85

answers:

3

I'm using a TableLayout for an Activity and if I have more than a certain number of TableRows a vertical line appears to the right of the screen.

alt text

If I use fewer Views in my layout, the line disappears. If this is not a bug, where should I look in my layout for problems?

+4  A: 

It is a scrollbar. It appears when your layout is longer than the screen. You can disable it on your TableLayout (android:scrollbars="none" in XML or setVerticalScrollBarEnabled(false) from code). However, you shouldn't do that because if you add too much rows, the user simply won't see them. If the scrollbar hides text, add a padding to the layout (android:padding="10dip").

molnarm
Thanks. All I needed was to add some padding.
kaciula
+1  A: 

The reason the line appears when you have over a certain amount of rows is because it is a ScrollBar, it means the amount of rows on your screen flow down below the visible page, the scroll bar allows the user to gesture towards the rest of the options.

In the same respect it's also why the bar disappears when there only a few rows, there's enough room for the rows to be shown correctly.

Jamie Keeling
A: 

Bear in mind that if you disable the scrollbar and intend on deploying the app on other phones - especially phones with smaller screens - you run the risk of cutting out part of the UI from users

skooter