title: How to make a tablelayout scroll vertically and horizontally
body: <p>How can I make a tablelayout scroll horizontally and vertically? The columns of this tablelayout are generated dynamically. At this moment he is only sliding vertically.</p>
  
  <p>In some situations the information contained in the tablelayout line will be too large and you will need to slide horizontally to view it completely.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
      &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:orientation="vertical" &gt;
  
          &lt;LinearLayout
              android:id="@+id/activity_linearLayout1"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:orientation="horizon`enter code here`tal" &gt;
  
              &lt;Spinner
                  android:id="@+id/activity_spinner1"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:gravity="start"
                  android:drawSelectorOnTop="true"
                  style="@android:style/Widget.Holo.Light.Spinner" /&gt;
  
              &lt;EditText
                  android:id="@+id/activity_edt1"
                  android:labelFor="@+id/consultaCliente_edt1"
                  android:layout_width="0dip"
                  android:layout_height="wrap_content"
                  android:layout_weight="1"
                  android:inputType="text"
                  style="@style/EditText" &gt;
              &lt;/EditText&gt;
  
              &lt;ImageView
                  android:id="@+id/activity_bt1"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:contentDescription="@string/bt1"
                  android:src="@drawable/search" /&gt;
  
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:id="@+id/activity_linearLayout2"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:gravity="start"
              android:orientation="horizontal" &gt;
  
              &lt;Spinner
                  android:id="@+id/activity_spinner2"
                  android:layout_width="0dp"
                  android:layout_weight="1"
                  android:layout_height="wrap_content"
                  android:gravity="start"
                  android:drawSelectorOnTop="true"
                  style="@android:style/Widget.Holo.Light.Spinner" /&gt;
  
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:id="@+id/activity_linearLayout3"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:gravity="start"
              android:orientation="horizontal" &gt;
  
              &lt;Spinner
                  android:id="@+id/activity_spinner3"
                  android:layout_width="0dp"
                  android:layout_weight="1"
                  android:layout_height="wrap_content"
                  android:gravity="start|bottom"
                  android:drawSelectorOnTop="true"
                  style="@android:style/Widget.Holo.Light.Spinner" /&gt;
  
              &lt;ImageView
                  android:id="@+id/activity_bt2"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:gravity="end"
                  android:layout_gravity="end"
                  android:contentDescription="@string/bt2"
                  android:src="@drawable/information" /&gt;
  
          &lt;/LinearLayout&gt;
  
          &lt;ScrollView
              android:id="@+id/activity_scrollView1"
              android:layout_width="match_parent"
              android:layout_height="0dip"
              android:layout_weight="1"&gt;
  
              &lt;TableLayout
                  android:id="@+id/activity_tableLayout1"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:orientation="vertical"
                  android:shrinkColumns="*"
                  android:stretchColumns="*" &gt;
              &lt;/TableLayout&gt;
  
          &lt;/ScrollView&gt;
  
          &lt;LinearLayout
              android:id="@+id/activity_linearLayout4"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_gravity="start"
              android:background="@color/orange"
              android:baselineAligned="false"
              android:orientation="horizontal" &gt;
  
              &lt;TextView
                  android:id="@+id/activity_txt1"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:paddingStart="0sp"
                  android:paddingEnd="10sp"
                  android:text="@string/txt1"
                  style="@style/TextViewBlack" /&gt;
  
          &lt;/LinearLayout&gt;
  
      &lt;/LinearLayout&gt;
  </code></pre>