Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Based on my experience, the <code>FragmentTabHost</code> doesn't care much about the xml definitions, things must be made programmatically. I got it working by leaving out the <code>HorizontalScrollView</code> from the xml and adding it in my <code>onCreate</code> for the <code>FragmentActivity</code>.</p> <p>The xml:</p> <pre><code>&lt;android.support.v4.app.FragmentTabHost xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@android:id/tabhost" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" &gt; &lt;TabWidget android:id="@android:id/tabs" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" /&gt; &lt;FrameLayout android:id="@android:id/tabcontent" android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="0" /&gt; &lt;FrameLayout android:id="@+id/realtabcontent" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" /&gt; &lt;/LinearLayout&gt; &lt;/android.support.v4.app.FragmentTabHost&gt; </code></pre> <p>Then in the onCreate after adding the tabs (also programmatically):</p> <pre><code>TabWidget tw = (TabWidget) findViewById(android.R.id.tabs); LinearLayout ll = (LinearLayout) tw.getParent(); HorizontalScrollView hs = new HorizontalScrollView(this); hs.setLayoutParams(new FrameLayout.LayoutParams( FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT)); ll.addView(hs, 0); ll.removeView(tw); hs.addView(tw); hs.setHorizontalScrollBarEnabled(false); </code></pre> <p>Don't know if this is the most elegant solution but it seems to work OK.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload