title: horizontal scrolling function
body: <p>I am developing an application that is suppose to have scrolling function on the tab layout. But I do not really know the way to implement it, can anyone help? I intend to add in more tabs at the top on the page and then scroll through the tabs horizontally.</p>
  
  <p>java code</p>
  
  <pre><code> import android.app.TabActivity;
   import android.content.Intent;
   import android.content.res.Resources;
   import android.os.Bundle;
   import android.widget.TabHost;
   import android.widget.TabHost.TabSpec;
  
   public class MainActivity extends TabActivity {
  
   public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.main);
  
   Resources ressources = getResources(); 
   TabHost tabHost = getTabHost(); 
  
   // Livingroom tab
   Intent intentAndroid = new Intent().setClass(this, livingroomActivity.class);
   TabSpec tabSpecAndroid = tabHost
   .newTabSpec("livingroom")
   .setIndicator("", ressources.getDrawable(R.drawable.Living))
   .setContent(intentLiving);
  
   // dadnmom tab
   Intent intentApple = new Intent().setClass(this, dadmomActivity.class);
   TabSpec tabSpecApple = tabHost
   .newTabSpec("Dadmom")
   .setIndicator("", ressources.getDrawable(R.drawable.icon_apple_config))
   .setContent(intentdadmom);
  
   // myroom tab
   Intent intentWindows = new Intent().setClass(this, myroomActivity.class);
   TabSpec tabSpecWindows = tabHost
   .newTabSpec("myroom")
   .setIndicator("", ressources.getDrawable(R.drawable.icon_windows_config))
   .setContent(intentmyroom);
  
   // kitchen room tab
   Intent intentBerry = new Intent().setClass(this, kitchenActivity.class);
   TabSpec tabSpecBerry = tabHost
   .newTabSpec("kitchen")
   .setIndicator("", ressources.getDrawable(R.drawable.icon_blackberry_config))
   .setContent(intentkitchen);
  
   // add all tabs 
   tabHost.addTab(tabSpecliving);
   tabHost.addTab(tabSpecdadmom);
   tabHost.addTab(tabSpecmyroom);
   tabHost.addTab(tabSpeckitchen);
  
   //set Windows tab as default (zero based)
   tabHost.setCurrentTab(0);
   }
  
   }
  </code></pre>
  
  <p>xml code</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
   &lt;TabHost xmlns:android="http://schemas.android.com/apk/res/android"
   android:id="@android:id/tabhost"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"&gt;
   &lt;LinearLayout
   android:orientation="vertical"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   android:padding="5dp"&gt;
   &lt;TabWidget
   android:id="@android:id/tabs"
   android:layout_width="fill_parent"
   android:layout_height="wrap_content" /&gt;
   &lt;FrameLayout
   android:id="@android:id/tabcontent"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   android:padding="5dp" /&gt;
   &lt;/LinearLayout&gt;
   &lt;/TabHost&gt;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/J68jg.jpg" alt="enter image description here"></p>