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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:41:09+00:00 2026-06-02T05:41:09+00:00

I need to develop an app with tab bar on the bottom, but I

  • 0

I need to develop an app with tab bar on the bottom, but I have lots of problems with Fragments, where Android documentation shows how to use TabHost and Fragments.
Because there is nothing shown, about how to do it right with every tab stack.

As I can go to tab1 it’s open Fragment A, then I want go into deep and open Fragment B and have the possibility to switch tab to tab2, as well as switch back seeing the same Fragment B in tab1.

There are some solutions creating for every tab a FragmentActivity, but for that management you should use TabActivity, which is deprecated.

So maybe I could draw my tab bar and put it on all layouts and every time user press tab bar button I just start an Activity ?

If this is possible maybe some had implemented this, or could show some tutorial how to draw, or use this?

Thanks.

  • 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-02T05:41:13+00:00Added an answer on June 2, 2026 at 5:41 am

    In XML down_tabs.xml you add this code

    <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">
        <FrameLayout android:id="@android:id/tabcontent"
            android:layout_width="fill_parent" android:layout_height="0dip"
            android:layout_weight="1" />
    
        <TabWidget android:id="@android:id/tabs"
            android:layout_width="fill_parent"        android:layout_height="wrap_content"
            android:layout_weight="0"  />
    </LinearLayout>
    

    And in Activity class add tabs specifications as,

    public void onCreate(Bundle savedInstanceState) {
    
        super.onCreate(savedInstanceState);
        setContentView(R.layout.down_tabs);
        initTabs();
    }
    
    private void initTabs() {
        // Set Calendar Tab
        // getTabWidget().setDividerDrawable(R.drawable.tab_divider);
        getTabWidget().setPadding(0, 0, 0, 0);
        addTab("", R.drawable.home_tab_drawable, CalendarUIActivity.class);
        addTab("", R.drawable.lucky_dates_drawable, LuckyDatesActivity.class);
        addTab("", R.drawable.life_stages_drawable, LifeStagesActivity.class);
        addTab("", R.drawable.find_items_drawable, FindItemsActivity.class);
        addTab("", R.drawable.more_tab_drawable, MoreActivity.class);
    }
    
    private void addTab(String labelId, int drawableId, Class<?> targetClass) {
        TabHost tabHost = getTabHost();
        Intent intent = new Intent(this, targetClass);
        TabHost.TabSpec spec = tabHost.newTabSpec("tab" + labelId);
    
        View tabIndicator = LayoutInflater.from(this).inflate(
                R.layout.tab_indicator, getTabWidget(), false);
        TextView title = (TextView) tabIndicator.findViewById(R.id.title);
        title.setText(labelId);
        ImageView icon = (ImageView) tabIndicator.findViewById(R.id.icon);
        icon.setImageResource(drawableId);
    
        tabIndicator.setBackgroundResource(R.drawable.tab_backgroud);
        // //////////
        spec.setIndicator(tabIndicator);
        spec.setContent(intent);
        tabHost.addTab(spec);
    
    }
    

    I hope it will works fine.

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

Sidebar

Related Questions

I need to develop an android app that achieves the following: Create an activity
I need to develop a native app both on iOS and Android. It is
need help regarding USSD Gateway. I have to develop an app, which will directly
I need to develop a browser app for use on a kiosk touchscreen ->
I need to develop an app that is using multithreading. Basicly, I have a
I need to develop an app that reads info from google calendar on Android.
I'm trying to develop an app having a tab bar controller with 5 bar
I need to develop an app that has the share function. I have to
I need to develop a Iphone 2D app for school project. I don't have
For example, the following URL shows the app in a tab: https://www.facebook.com/just.to.get.a.rep?sk=app_203403406338325 But when

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.