Reputation: 1719
In my android application i am using a table inside a scrollview but am not able to scroll horizontally if the length of content is more. Could you please let me know any solution for this?
Thanks in advance:)
Upvotes: 1
Views: 1727
Reputation: 3804
Another option is by using GridView
Lastly, multiply number of columns with the width of each columns
GridView gridView = (GridView) findViewById(R.id.grid_view);
int numberOfColumns = 3;
int sizeOfWidthPerColumn = 20;
gridView.setNumColumns(numberOfColumns);
ViewGroup.LayoutParams layoutParams = gridView.getLayoutParams();
layoutParams.width = convertDpToPixels(numberOfColumns * sizeOfWidthPerColumn, this);
gridView.setLayoutParams(layoutParams);
Now I am able to scroll the GridView horizontally and vertically.
Upvotes: 0
Reputation: 7986
XML layout:
<ScrollView ...>
<HorizontalScrollView ...>
YOUR TABLE HERE
</HorizontalScrollView>
</ScrollView>
Upvotes: 4