title: Android: tabs don't fill parent with Holo theme?
body: <p>The below code creates a View with 4 tabs.  Using the default theme (no theme defined in the androidmanifest.xml), I get the first image, in which the tabs grow equally to fill the available space.  If I set theme to <code>android:theme="@android:style/Theme.Holo"</code>, I get the second image, in which the tabwidget (with the green background) still fills the parent's width, but the tabs do not grow to fill the tabwidget.  </p>
  
  <p>Any ideas of how I can get the first result while using Theme.Holo?</p>
  
  <p><img src="https://i.stack.imgur.com/aeRvB.png" alt="enter image description here"></p>
  
  <p><img src="https://i.stack.imgur.com/rqwPM.png" alt="enter image description here"></p>
  
  <pre><code>public class TempProjActivity extends Activity 
  {
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) 
      {
          super.onCreate(savedInstanceState);
  
          setContentView(new MyTabHost(this));
      }
  
      private class MyTabHost extends TabHost
      {
          public MyTabHost(Context context) 
          {
              super(context, null);
  
              setId(android.R.id.tabhost);
  
              TabWidget widget = new TabWidget(getContext());
              widget.setId(android.R.id.tabs);
              widget.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
              widget.setBackgroundColor(Color.GREEN);
  
              FrameLayout layout = new FrameLayout(getContext());
              layout.setId(android.R.id.tabcontent);
              layout.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
  
              LinearLayout linearLayout = new LinearLayout(getContext());
              linearLayout.setOrientation(LinearLayout.VERTICAL);
              linearLayout.setLayoutParams(new TabHost.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
              linearLayout.addView(widget);
              linearLayout.addView(layout);
  
              addView(linearLayout);
  
              setup();
  
              TabSpec spec = newTabSpec("tab1");
              spec.setIndicator("", getContext().getResources().getDrawable(R.drawable.ic_launcher));
              spec.setContent(new TabContentFactory() 
              {
                  @Override
                  public View createTabContent(String tag) 
                  {
                      return new View(getContext());
                  }
              });
              addTab(spec);
  
              spec = newTabSpec("tab2");
              spec.setIndicator("", getContext().getResources().getDrawable(R.drawable.ic_launcher));
              spec.setContent(new TabContentFactory() 
              {
                  @Override
                  public View createTabContent(String tag) 
                  {
                      return new View(getContext());
                  }
              });
              addTab(spec);
  
              spec = newTabSpec("tab3");
              spec.setIndicator("", getContext().getResources().getDrawable(R.drawable.ic_launcher));
              spec.setContent(new TabContentFactory() 
              {
                  @Override
                  public View createTabContent(String tag) 
                  {
                      return new View(getContext());
                  }
              });
              addTab(spec);
  
              spec = newTabSpec("tab5");
              spec.setIndicator("", getContext().getResources().getDrawable(R.drawable.ic_launcher));
              spec.setContent(new TabContentFactory() 
              {
                  @Override
                  public View createTabContent(String tag) 
                  {
                      return new View(getContext());
                  }
              });
              addTab(spec);
          }
  
      }
  }
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>If I add the below code at the end of MyTabHost's constructor, I get the below image.  However the icon is still not centered in the tabs, and it doesn't seem like a particularly safe piece of code.  </p>
  
  <p>Any idea of better options than this? Or opinions on if this is a reasonable option?</p>
  
  <p><img src="https://i.stack.imgur.com/wVxMR.png" alt="enter image description here"></p>
  
  <pre><code>        post(new Runnable() 
          {
  
              @Override
              public void run() 
              {
                  for(int i = 0; i &lt; widget.getChildCount(); i++)
                  {
                      widget.getChildAt(i).getLayoutParams().width = getWidth()/widget.getChildCount();
                  }
              }
          });
      }
  </code></pre>