title: Android:Vertical and horizontal scrolling with constrains on top and left
body: <p>I would like to implement the following scroll view with vertical and horizontal scrolling:</p>
  
  <pre><code>       9:00    9:30    10:00    10:30    11:00    ...
  item1  hi11    hi12    hi13     hi14     hi15     ...
  item2  hi21    hi22    hi23     hi24     hi25     ...
  item3  hi31    hi32    hi33     hi34     hi35     ...
  ...    ...     ...     ...      ...      ...      ...
  </code></pre>
  
  <p>but in addition I would like to apply the following two constrains:</p>
  
  <p>1) If the user scrolls, from down to top, the area filled with "hi"; then the first row (time) must remain visible:</p>
  
  <p>2) If the user scrolls, from right to left, the area filled with "hi"; then the first column (item1, item2, ...) must remain visible.</p>
  
  <p>So, after scrolling vertical and horizontally the view can have the following appearance:</p>
  
  <pre><code>        16:00   16:30   17:00    17:30    18:00   ...
  item23  abc     cde     efg      gfr      dfr     ...
  item24  cvd     qwe     aqw      asw      dfr     ...
  item25  dle     zwq     wer      ser      zzz     ...
  ...     ...     ...     ...      ...      ...     ...
  </code></pre>
  
  <p>The solution that I have found so far is based on Layouts and also creating items dynamically; however this solution has the problem of not synchronising the horizontal scrolling in the central area (hi11, hi12, hi13) with the time row (9:00 9:30 10:00 ...).</p>
  
  <p>So, I need a way to detect horizontal scrolling in the "central area" and apply the same horizontal scroll to the "time area" (and, if possible, vice versa).</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:orientation="vertical" &gt;
  
      &lt;HorizontalScrollView
          android:layout_width="fill_parent"
          android:layout_height="wrap_content" &gt;
  
          &lt;LinearLayout
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:orientation="vertical" &gt;
  
              &lt;LinearLayout
                  android:id="@+id/epg_time_list"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:orientation="horizontal" /&gt;
                   &lt;!-- In code: Create several TextView's time 
                    items and add them to this layout in order to
                    to create the first row which shows the time HH:mm --&gt;
  
          &lt;/LinearLayout&gt;
      &lt;/HorizontalScrollView&gt;
  
      &lt;ScrollView
          android:layout_width="fill_parent"
          android:layout_height="wrap_content" &gt;
  
          &lt;LinearLayout
              android:id="@+id/epg_channel_list_master_master"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:orientation="vertical" &gt;
  
              &lt;LinearLayout
                  android:id="@+id/epg_channel_list_master_detail"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:orientation="horizontal" &gt;
  
                  &lt;LinearLayout
                      android:id="@+id/epg_channel_list_master"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:orientation="vertical" &gt;
  
                      &lt;!-- In code: Create a TextView for every item
                        to create the first column (item1, item2, ...) --&gt;
  
                  &lt;/LinearLayout&gt;
  
                  &lt;HorizontalScrollView
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content" &gt;
  
                          &lt;LinearLayout
                              android:id="@+id/epg_channel_list_detail_container"
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:orientation="vertical" &gt;
  
  
                              &lt;!-- In code: Create a horizontal LinearLayout for
                              every row. Every row will contain several
                              TextViews with short names --&gt;
  
                          &lt;/LinearLayout&gt;
                  &lt;/HorizontalScrollView&gt;
              &lt;/LinearLayout&gt;
          &lt;/LinearLayout&gt;
      &lt;/ScrollView&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>