Question

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 http://dl.dropbox.com/u/5342899/device.png

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?

Was it helpful?

Solution

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").

OTHER TIPS

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.

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top