title: Scrollview stopped working when I added tabs to the actionbar
body: <p><strong>Background:</strong> I develop for Android 4 (SDK 15) and use the native actionbar. In one of my activities I have a fragment with a scrollview as the root element. The fragment fills the content. I do not set a layout for the activity, I only add the fragment. It all works fine.</p>
  
  <p><strong>Problem:</strong> When I add tabs to the actionbar the scroll view doesn't work anymore. The scrollbar shows up when I tap the screen but there is no scrolling.</p>
  
  <p>I have a second fragment for the second tab. It is a WebView and it scrolls perfectly.</p>
  
  <p>Has anyone experienced this or does anyone have any idea?</p>
  
  <p>The tabs are added with this code:</p>
  
  <pre><code>    final ActionBar actionBar = getActionBar();
  
      actionBar.setDisplayOptions(ActionBar.DISPLAY_HOME_AS_UP
              | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_CUSTOM);
      actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
  
      // Set the name of the current entity as the title of the action bar.
      final TextView textView = (TextView) getLayoutInflater().inflate(
              R.layout.action_bar_text_view, null);
      textView.setText(getGuideContext().getSelectedEntity().getName(
              getGuidePreferences().getNameLang()));
      actionBar.setCustomView(textView);
  
      // Show the actionbar now that the text view is set up.
      actionBar.show();
  
      // Set the tabs.
      final Entity entity = getGuideContext().getSelectedEntity();
  
      final DetailsTabListener factsListener = new DetailsTabListener(
              DetailsMode.FACTS, entity, details);
      actionBar.addTab(actionBar.newTab()
              .setText(getString(R.string.details_tab_facts))
              .setTabListener(factsListener));
  
      final DetailsTabListener webListener = new DetailsTabListener(
              DetailsMode.WEB, entity, details);
      actionBar.addTab(actionBar.newTab()
              .setText(getString(R.string.details_tab_web))
              .setTabListener(webListener));
  </code></pre>
  
  <p>This is the DetailsTabListener:</p>
  
  <pre><code>public class DetailsTabListener implements TabListener {
  
  /** The current details mode. */
  private final DetailsMode detailsMode;
  
  /** A reference to the details of the current entity. */
  private final WeakReference&lt;Details&gt; detailsRef;
  
  /** A reference to the current entity. */
  private final WeakReference&lt;Entity&gt; entityRef;
  
  /** Holds a reference to the fragment this listener last created. */
  private WeakReference&lt;Fragment&gt; fragmentRef;
  
  /**
   * The constructor.
   * 
   * @param detailsMode
   *            the current details mode, i.e. the type of fragment this
   *            listener is listening to, must not be null
   * @param entity
   *            the currently selected entity, must not be null
   * @param details
   *            details for the current entity, must not be null
   */
  public DetailsTabListener(final DetailsMode detailsMode,
          final Entity entity, final Details details) {
  
      if ((detailsMode == null) || (entity == null) || (details == null)) {
          throw new IllegalArgumentException(
                  "None of the parameters detailsMode, entity or details can be null.");
      }
  
      this.detailsMode = detailsMode;
      this.entityRef = new WeakReference&lt;Entity&gt;(entity);
      this.detailsRef = new WeakReference&lt;Details&gt;(details);
  }
  
  /** {@inheritDoc} */
  @Override
  public void onTabReselected(Tab tab, FragmentTransaction ft) {
  
      if (fragmentRef == null) {
          return;
      }
  
      // Scroll to top.
      final Fragment fragment = fragmentRef.get();
      if (fragment instanceof ScrollToTopInterface) {
          ((ScrollToTopInterface) fragment).scrollToTop();
      }
  }
  
  /** {@inheritDoc} */
  @Override
  public void onTabSelected(Tab tab, FragmentTransaction ft) {
  
      // Sets a fragment that was created earlier if there is one.
      Fragment fragment = null;
      if (fragmentRef != null) {
          fragment = fragmentRef.get();
      }
  
      // Creates and adds a new fragment if there is none, or attach the old
      // one if it exists.
      if (fragment == null) {
          fragment = DetailsFragmentFactory.createFragment(detailsMode,
                  entityRef.get(), detailsRef.get());
          fragmentRef = new WeakReference&lt;Fragment&gt;(fragment);
          ft.add(android.R.id.content, fragment, "");
      } else {
          ft.attach(fragment);
      }
  }
  
  /** {@inheritDoc} */
  @Override
  public void onTabUnselected(Tab tab, FragmentTransaction ft) {
  
      // Detach the fragment if there is one.
      if (fragmentRef != null) {
          ft.detach(fragmentRef.get());
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>This is the layout of the fragment:</p>
  
  
  
  <pre><code>&lt;ScrollView 
  android:id="@+id/details_facts_scroll_view"
  android:layout_height="match_parent" 
  android:layout_width="match_parent"
  xmlns:android="http://schemas.android.com/apk/res/android"    
  &gt;
  
  &lt;LinearLayout
      android:layout_height="wrap_content"
      android:layout_marginBottom="@dimen/details_facts_margin_top_bottom"
      android:layout_marginTop="@dimen/details_facts_margin_top_bottom"       
      android:layout_width="match_parent"
      android:orientation="vertical"
      &gt;
  
      &lt;LinearLayout
          android:baselineAligned="false"
          android:layout_height="wrap_content"
          android:layout_marginTop="@dimen/details_facts_header_margin_top"
          android:layout_width="match_parent"
          android:orientation="horizontal"
          &gt;
  
          &lt;TextView
              android:layout_weight="0.5"
              android:text="@string/details_length"
              style="@style/details_fact_header"
          /&gt;
  
          &lt;TextView
              android:layout_weight="0.5"                 
              android:text="@string/details_weight"
              style="@style/details_fact_header"
          /&gt;
  
      &lt;/LinearLayout&gt;
  
      &lt;LinearLayout
          android:baselineAligned="false"
          android:layout_height="wrap_content"
          android:layout_width="match_parent"
          android:orientation="horizontal"
          &gt;
  
          &lt;TextView
              android:id="@+id/details_length"
              android:layout_weight="0.5"
              style="@style/details_fact"
          /&gt;
  
          &lt;TextView
              android:id="@+id/details_weight"
              android:layout_weight="0.5"                 
              style="@style/details_fact"
          /&gt;
  
      &lt;/LinearLayout&gt;
  
      &lt;LinearLayout
          android:baselineAligned="false"
          android:layout_height="wrap_content"
          android:layout_marginTop="@dimen/details_facts_header_margin_top"
          android:layout_width="match_parent"
          android:orientation="horizontal"
          &gt;
  
          &lt;TextView
              android:layout_weight="0.5"                 
              android:text="@string/details_wingspan"
              style="@style/details_fact_header"
          /&gt;
  
          &lt;TextView
              android:layout_weight="0.5"        
              android:text="@string/details_age"
              style="@style/details_fact_header"
          /&gt;
  
      &lt;/LinearLayout&gt;
  
     &lt;LinearLayout
          android:baselineAligned="false"
          android:layout_height="wrap_content"
          android:layout_width="match_parent"
          android:orientation="horizontal"
          &gt;         
  
          &lt;TextView
              android:id="@+id/details_wingspan"
              android:layout_weight="0.5"                 
              style="@style/details_fact"
          /&gt;
  
          &lt;TextView
              android:id="@+id/details_age"
              android:layout_weight="0.5"        
              style="@style/details_fact"
          /&gt;
  
      &lt;/LinearLayout&gt;
  
      &lt;TextView
          android:id="@+id/details_photograph_section_header"
          android:text="@string/details_photograph_section_header"
          style="@style/details_fact_section_header"
      /&gt;
  
      &lt;View
          android:id="@+id/details_photograph_section_divider"
          style="@style/divider"
      /&gt;
  
      &lt;ImageView
          android:contentDescription="@string/details_image_content_description"
          android:id="@+id/details_image"
          android:layout_height="wrap_content"
          android:layout_marginRight="@dimen/details_facts_margin_left_right"
          android:layout_width="wrap_content"
      /&gt;
  
      &lt;TextView
          android:id="@+id/details_image_text"
          style="@style/details_image_text"
      /&gt;
  
  
      &lt;TextView
          android:text="@string/details_taxonomy_section_header"
          style="@style/details_fact_section_header"
      /&gt;
  
      &lt;View
          style="@style/divider"
      /&gt;
  
      &lt;TextView
          android:layout_marginTop="@dimen/details_facts_header_margin_top"
          android:text="@string/details_english"
          style="@style/details_fact_header"
      /&gt;
  
      &lt;TextView
          android:id="@+id/details_taxonomy_english"
          style="@style/details_fact"
      /&gt;
  
      &lt;TextView
          android:layout_marginTop="@dimen/details_facts_header_margin_top"       
          android:text="@string/details_latin"
          style="@style/details_fact_header"
      /&gt;
  
      &lt;TextView
          android:id="@+id/details_taxonomy_latin"
          style="@style/details_fact"
      /&gt;
  
      &lt;TextView
          android:layout_marginTop="@dimen/details_facts_header_margin_top"       
          android:text="@string/details_swedish"
          style="@style/details_fact_header"
      /&gt;
  
      &lt;TextView
          android:id="@+id/details_taxonomy_swedish"
          style="@style/details_fact"
      /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p></p>