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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:32:18+00:00 2026-06-04T03:32:18+00:00

When I use views as tabSpec indicator the view is the same when a

  • 0

When I use views as tabSpec indicator the view is the same when a tab is selected or not.

Is there any way to use different views like when we use different drawable (selector) for the selected tab?

I already tried using the selector but it only allow to change the icon. What I want is the use a custom view and still be able to use different views for the different tab states.

Here is my code:

View profilInd = getLayoutInflater().inflate(R.layout.tabs_profil_layout, null);
Intent profilIntent = new Intent(this, MyProfilActivity.class);
tabHost.addTab(tabHost.newTabSpec("profil").setIndicator(profilInd).setContent(profilIntent));

The tabs_profil_layout layout is a simple LinearLayout with an ImageView and a TextView.

  • 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-04T03:32:19+00:00Added an answer on June 4, 2026 at 3:32 am

    What you want to do is use a selector in your view/drawable which will change between the selected and not selected states.

    This question covers some similar topics: Android : Customizing tabs on state : How do I make a selector a drawable

    Essentially you will be making a drawable resource that looks something like this:

     <?xml version="1.0" encoding="utf-8"?>
     <selector xmlns:android="http://schemas.android.com/apk/res/android">
         <item android:state_pressed="true"
               android:drawable="@drawable/button_pressed" /> <!-- pressed -->
         <item android:state_focused="true"
               android:drawable="@drawable/button_focused" /> <!-- focused -->
         <item android:drawable="@drawable/button_normal" /> <!-- default -->
     </selector>
    

    Which you will then assign to the tab.

    You can learn more about selectors and Drawable here.

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

Sidebar

Related Questions

I am using Rails 3.2.1. Is it possible to use different views when using
I have two tabbar items(views) that use the same data, whats the best solution
I can use MySQL views in Hibernate by treating them like tables - ie.
I've noticed there are several ways to use Views and PartialViews: RenderAction, RenderPartial, and
I've built a view (Drupal 6.x, Views 2.x). I'd like to be able to
Question: Is there a way to make view PERSON for user jack point to
Situation: In Drupal, when you use Views module, it restricts to display Search Form
im trying to use the views nivo slider module after the minor update to
We make use of views and panels quite often in Drupal and a lot
in our require.js and backbone.js app we use many views and templates. in a

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.