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 5970275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:21:05+00:00 2026-05-22T20:21:05+00:00

I’m having troubles trying to style my tabs in android. I want to make

  • 0

I’m having troubles trying to style my tabs in android.

I want to make them look exactly the same as whats in the open source android contacts list (see https://android.googlesource.com/platform/packages/apps/Contacts
).

Problem is that when they display on the screen it looks a bit different to the contacts app.

my tabs

When it should look like this:

enter image description here

Notice how the background colors are a little bit different and the text colors are different.

Not sure why this is the case as its basically the same code and icons.

My tab layout code is the following:

<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@android:id/tabhost"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <LinearLayout
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:padding="0dp">
        <TabWidget
            android:id="@android:id/tabs"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" />
        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:padding="0dp" />
    </LinearLayout>
</TabHost>

Which doesn’t contain anything special there.. and the TabActivity is as follows:

public class TabbedActivity extends TabActivity implements
        TabHost.OnTabChangeListener {

    private TabHost tabHost;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        final Intent intent = getIntent();

        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.tab);

        tabHost = getTabHost();
        tabHost.setOnTabChangedListener(this);

        setupLatestTab();
        setupSavedTab();

        tabHost.setCurrentTab(0);
    }

    private void setupLatestTab() {

        Intent intent = new Intent().setClass(this, ResultsActivity.class);

        tabHost.addTab(tabHost
                .newTabSpec("latest")
                .setIndicator("Latest",
                        getResources().getDrawable(R.drawable.ic_tab_recent))
                .setContent(intent));
    }

    private void setupSavedTab() {

        Intent intent = new Intent().setClass(this, ResultsActivity.class);

        tabHost.addTab(tabHost
                .newTabSpec("saved")
                .setIndicator("Saved",
                        getResources().getDrawable(R.drawable.ic_tab_starred))
                .setContent(intent));
    }

    @Override
    public void onTabChanged(String tabId) {
        // Because we're using Activities as our tab children, we trigger
        // onWindowFocusChanged() to let them know when they're active. This may
        // seem to duplicate the purpose of onResume(), but it's needed because
        // onResume() can't reliably check if a keyguard is active.
        Activity activity = getLocalActivityManager().getActivity(tabId);
        if (activity != null) {
            activity.onWindowFocusChanged(true);
        }
    }

}

I am using the same images from the drawable folders too.

I know i can set the background of tabs manually by doing something like this in the tabactivity

tabHost.getTabWidget().getChildAt(index).setBackgroundColor(Color.parseColor("#ff202020"));

But the contacts app isn’t doing this sort of thing anywhere (most of the top tab code is in DialtactsActivity), so just want to do what the open source app is doing when displaying tabs – i’m not sure how and why the contacts application tabs look much better when im basically using the same code and resources.

I guess im just missing something trivial??

  • 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-05-22T20:21:06+00:00Added an answer on May 22, 2026 at 8:21 pm

    This turned out to be a problem with my minimum android version not being specified ..

    Added:

    <uses-sdk android:minSdkVersion="8" />
    

    to the androidmanifest and it worked fine. I guess it was reverting to the old tabs look and feel in earlier versions of android.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I'm interested in microtypography issues on the web. I want a tool to fix:
I am trying to render a haml file in a javascript response like so:

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.