How to show data in a timetable?

747 Views Asked by At

Me and a friend are trying to do a timetable of a train schedule , but we are now stuck in how to show the data from the Sqlite database. We can show the data, but not how we want it.

I did a sketch in paint to show what we want to do.

https://i.stack.imgur.com/5XUfV.png

When scrolling vertically above the "stations" table, both the "Stations" and the "Times" should scroll vertically, but when scrolling above "Times",only "Times" should scroll horizontally (stations should stay the same).

Does anyone have an idea of how we should do this (we are beginners in programming, and in android programming)?

Thanks :) !

edit:

I found an app that does what I want, this way is easier for everyone to understand

Google Play - Sydney Rail Beta

(it does not let me put 2 link, so I removed the http) i.stack.imgur.com/ktS8J.jpg

1

There are 1 best solutions below

2
On

For vertical scrolling you can use ScrollView ( http://developer.android.com/reference/android/widget/ScrollView.html )

I'm not sure why you need to scroll 'Times' when scrolling 'Stations', but you can use HorizontalScrollView modified in this way Synchronise ScrollView scroll positions - android

In OnScrollChanged method you can use scrollTo method of your HorizontalScrollView to scroll to desired position.