title: TabHost not filling entire screen when calculating tab width according to screen width
body: <p>I have a <code>TabHost</code> containing five tabs within a horizontal <code>ScrollView</code>. I want all tabs to have the same size with a minimum size of 83dp. If the fifth tab fits on screen, all tabs are widened to fill the entire screen. Here is the code to achieve this:</p>
  
  <pre><code>int tabMinWidth = (int) (83 * density);
  int tabWidth = tabMinWidth
  int nrOfTabs = displayMetrics.widthPixels / tabMinWidth;
  if (nrOfTabs &gt; 4)
      tabWidth = displayMetrics.widthPixels / 5;
  for(int i = 0; i &lt; 5; i++)
      tabHost.getTabWidget().getChildAt(i).getLayoutParams().width = tabWidth;
  </code></pre>
  
  <p>Basically the code works fine. However, not the entire screen width is used by the tabs. Example: five tabs with 96px do not fill a 320x480 screen in landscape mode (about 20px unused space), although 96 x 5 is exactly 480. How can I improve the code so that the tabs really fill the entire screen?</p>
  
  <p><strike>
  UPDATE:
  Solution: I found that resizing each tab by about 4-5% works quite well:</p>
  
  <pre><code>tabWidth = (int) (tabWidth *1.04);
  </code></pre>
  
  <p></strike></p>
  
  <p>UPDATE 2:
  I think I found the cause of the problem. The tabs have a negative right and left margin. Considering these margins solves the problem and the <code>TabHost</code> fills exactly the whole screen.</p>