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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T08:27:43+00:00 2026-06-08T08:27:43+00:00

The app has an ActionBar, and the ActionBar has Navigation Tabs, each containing text.

  • 0

The app has an ActionBar, and the ActionBar has Navigation Tabs, each containing text. I need to add icons to the tabs, in addition to the text.

I have added the icons using ActionBar.Tab.setIcon(drawable) successfully, but the icon shows to the left of the tab text.

How do I move the tab icon so it is ABOVE the navigation tab text?

(I’m using ActionBarSherlock, but figure the solution to this will work across native and ABS implementations)

  • 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-08T08:27:46+00:00Added an answer on June 8, 2026 at 8:27 am

    You can set a custom view to each tab.

    https://gist.github.com/3167287

    PropositionListActivity.java

    import com.actionbarsherlock.app.ActionBar;
    import com.actionbarsherlock.app.ActionBar.Tab;
    import com.actionbarsherlock.app.SherlockActivity;
    import android.os.Bundle;
    import android.app.Activity;
    import android.graphics.Color;
    import android.graphics.drawable.Drawable;
    import android.util.Log;
    import android.view.Menu;
    import android.view.MenuItem;
    import android.widget.ArrayAdapter;
    import android.widget.Button;
    import android.widget.ListView;
    import android.widget.TextView;
    import android.widget.ImageView;
    import android.support.v4.app.FragmentTransaction;
    import android.support.v4.app.NavUtils;
    
    public class PropositionListActivity extends SherlockActivity implements ActionBar.TabListener {
    
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState); 
    
            setContentView(R.layout.proposition_list);
    
            getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    
            createTab(R.layout.tab_to_opine, R.id.tab_to_opine_title, "Vou Opinar");
            createTab(R.layout.tab_opined, R.id.tab_opined_title, "Já Opinei");
            createTab(R.layout.tab_feedback, R.id.tab_feedback_title, "Feedback");
        }
    
        public void createTab(int view, int titleView, String title) {
            ActionBar.Tab tab = getSupportActionBar().newTab();
            tab.setTabListener(this);
            tab.setCustomView(view);
            getSupportActionBar().addTab(tab);
    
            ((TextView) findViewById(titleView)).setText(title);
        }
    }
    

    tab_to_opine.xml

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >
    
        <ImageView
            android:id="@+id/tab_icon"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/tab_to_opine"
            android:background="@android:color/transparent" />
    
        <TextView
            android:id="@+id/tab_to_opine_title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    
    </LinearLayout>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ActionBar in an app, and it has navigation tabs embedded in
The app has an Action Bar, the action bar has several navigation tabs on
I've an existing app which has couple of tabs, buttons in the actionbar. I
I have an app where the MainActivity which creates an ActionBar with tabs (used
My app has four tabs: A , B , C and D . Their
I have an Android app that uses ActionBar Sherlock. I create a menu that
My app has a singleton class called CycleManager. I have created a sealed class
My app has very different UI structures for each orientation. At what stage in
My app has a UINavigationController . All the controllers I push onto the navigation
My app has stopped working on the emulatorUnfortunately. I have the logcat with me,

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.