Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I have three tabs and a custom divider, however a custom xml (customtabview.xml) is used for all five tabs.</p> <p>Tabs.java</p> <pre><code> tabHost = getTabHost(); TabHost.TabSpec spec; LinearLayout v = (LinearLayout)(getLayoutInflater().inflate(R.layout.customtabview, null)); //FIRST TAB ((TextView)v.findViewById(R.id.title)).setText("FIRST"); ((TextView)v.findViewById(R.id.title)).setCompoundDrawablesWithIntrinsicBounds(0,R.drawable .tab_back,0,0 ); spec = tabHost.newTabSpec("first").setIndicator(v).setContent(R.id.tab_first_info); tabHost.addTab(spec); //SECOND TAB ((TextView)v.findViewById(R.id.title)).setText("SECOND"); ((TextView)v.findViewById(R.id.title)).setCompoundDrawablesWithIntrinsicBounds(0,R.drawable.tab_back,0,0 ); spec = tabHost.newTabSpec("second").setIndicator(v).setContent(R.id.tab_second_info); tabHost.addTab(spec); //THIRD TAB ((TextView)v.findViewById(R.id.title)).setText("THIRD"); ((TextView)v.findViewById(R.id.title)).setCompoundDrawablesWithIntrinsicBounds(0,R.drawable.tab_back,0,0 ); spec = tabHost.newTabSpec("third").setIndicator(v).setContent(R.id.tab_third_info); tabHost.addTab(spec); </code></pre> <p>customtabview.xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:gravity="center" &gt; &lt;TextView android:id="@+id/title" android:drawablePadding="4dp" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; &lt;/LinearLayout&gt; </code></pre>
 

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