Note that there are some explanatory texts on larger screens.

plurals
  1. POChange colour of line under the tab if selected
    primarykey
    data
    text
    <p>I have used a TabHost to setup my tabs, but now i want to change the color of line under the tab if selected. I know this is possible only with action bar or Action bar sherlock. So i searched a lot on SO but found no proper answer as to how to change the colour of line under the tabs. I have managed to set up the tabs using action bar sherlock library.</p> <p>Here is a image of what i want <img src="https://i.stack.imgur.com/QY2Sm.png" alt="enter image description here"></p> <p>Hope it shows what i want. </p> <p>This is the main class of </p> <pre><code>public class MainActivity extends SherlockActivity implements ActionBar.TabListener { private TextView mSelected; public int THEME = R.style.Theme_Sherlock; @Override public void onCreate(Bundle savedInstanceState) { setTheme(THEME); // Used for theme switching in samples super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mSelected = (TextView) findViewById(R.id.text); getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); for (int i = 1; i &lt;= 3; i++) { ActionBar.Tab tab = getSupportActionBar().newTab(); tab.setText("Tab " + i); tab.setTabListener(this); getSupportActionBar().addTab(tab); } } @Override public void onTabReselected(Tab tab, FragmentTransaction transaction) { } @Override public void onTabSelected(Tab tab, FragmentTransaction transaction) { mSelected.setText("Selected: " + tab.getText()); } @Override public void onTabUnselected(Tab tab, FragmentTransaction transaction) { } } </code></pre> <p>and the xml is </p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; </code></pre> <p></p> <pre><code>&lt;TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginBottom="20dp" android:text="tab_navigation_content" /&gt; &lt;TextView android:id="@+id/text" android:layout_width="fill_parent" android:layout_height="wrap_content" /&gt; </code></pre> <p></p> <p>and i have used <a href="https://github.com/JakeWharton/ActionBarSherlock" rel="nofollow noreferrer">this</a> library.</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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