Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8801523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:51:26+00:00 2026-06-14T00:51:26+00:00

adapter.addTab(getSupportActionBar().newTab().setText(Tab-1), Tab1.class, null); adapter.addTab(getSupportActionBar().newTab().setText(Tab-2), Tab2.class, null); adapter.addTab(getSupportActionBar().newTab().setText(Tab-3), Tab3.class, null); As of now every Tab

  • 0
adapter.addTab(getSupportActionBar().newTab().setText("Tab-1"),
                Tab1.class, null);
adapter.addTab(getSupportActionBar().newTab().setText("Tab-2"),
                Tab2.class, null);
adapter.addTab(getSupportActionBar().newTab().setText("Tab-3"),
                Tab3.class, null);

As of now every Tab has its TextColor as white. I want it to be grey when not selected and white on selected. So, how can i change the text color in onTabSelected or onTabUnselected.

Or should i go with setCustomView for the tab?? Here again the TextSize and all needs to be taken care of

<style name="my_ActionBarTabStyle" parent="@style/Widget.Sherlock.ActionBar.TabView">
    <item name="background">@drawable/tab_indicator_ab_wicfy</item>
    <item name="android:background">@drawable/tab_indicator_ab_wicfy</item>
    <item name="android:textColor">@color/black</item>
</style>

i tried to use

<item name="textColor">@color/black</item>

but it gives me error that textColor is not a valid attribute

Thank You

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T00:51:27+00:00Added an answer on June 14, 2026 at 12:51 am

    You should not change text color from the code. Use color state list resource instead.

    Define the color selector in resources. Define a xml file in res/color/ directory. The file will contain:

    <?xml version="1.0" encoding="utf-8"?>
    <selector xmlns:android="http://schemas.android.com/apk/res/android">
        <!-- use when selected -->
        <item android:state_selected="true" android:color="#fff" />
    
        <!-- otherwise use -->
        <item android:color="#888" />
    </selector>
    

    And then set the text color in a style:

    <item name="android:textColor">@color/my_color_selector</item>
    

    Edit:

    You have to set the text color in the right place in the styles! Set the textColor in (android:)actionBarTabTextStyle. The theme has to contain:

    <style name="MyTheme" parent="Theme.Sherlock.Light.DarkActionBar">
        ...
        <!-- define text style for tabs -->
        <item name="actionBarTabTextStyle">@style/MyTabTextStyle</item>
        <item name="android:actionBarTabTextStyle">@style/MyTabTextStyle</item>
        ...
    </style>
    

    Then set the text color in the tab text style:

    <style name="MyTabTextStyle" parent="Widget.Sherlock.ActionBar.TabText" >
        <item name="android:textColor">@color/my_color_selector</item>
    </style>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have three 2 tab TabA and TabB. TabA displays value its ok. Now
In the adapter class of Listview i have added setOnClickListener event for each of
I have a custom adapter for my ListView which has multiple TextViews. I want
I deployed a resource adapter (XADisk) in jboss 7.1.0.final and now get an exception
I have my Box adapter that extends BaseAdapter public class BoxAdapter extends BaseAdapter {
I have an custom ExpandableListView Adapter: public class MyExpandableListView extends BaseExpandableListAdapter { private Context
Im using a Sectioned adapter . Each section has a subAdapter. I get a
Both the adapter class and the target class implement the same interface...why can I
I created custom adapter like this public class SettingsAdapter extends BaseAdapter{ ArrayList<String> Noptions =
I created an adapter public class MyArrayAdapter extends ArrayAdapter<Watch> overriding public MyArrayAdapter(Context context, List<Watch>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.