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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:08:19+00:00 2026-05-29T23:08:19+00:00

Im trying to set my tabs as a scrollbar. I have 6 tabs but

  • 0

Im trying to set my tabs as a scrollbar. I have 6 tabs but want to show 3 in the UI. How do I set the scrollbar view in this format? If it even possible to set it like this?

Tab Bar is based on androids developer page.

Thanks

<?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">
  <ScrollView android:layout_width="fill_parent" 
    android:layout_height="wrap_content" >
    <LinearLayout
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:padding="5dp">

       <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="5dp" />
</LinearLayout>
</ScrollView>

Java file

package developers.tab;

import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;

public class AndroidDevelopersTabActivity extends TabActivity {
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    Resources res = getResources(); // Resource object to get Drawables
    TabHost tabHost = getTabHost();  // The activity TabHost
    TabHost.TabSpec spec;  // Resusable TabSpec for each tab
    Intent intent;  // Reusable Intent for each tab

    // Create an Intent to launch an Activity for the tab (to be reused)
    intent = new Intent().setClass(this, WorkoutActivity.class);

    // Initialize a TabSpec for each tab and add it to the TabHost
    spec = tabHost.newTabSpec("workouts").setIndicator("Workout",
                      res.getDrawable(R.drawable.ic_tab_workout))
                  .setContent(intent);
    tabHost.addTab(spec);

    // Do the same for the other tabs
    intent = new Intent().setClass(this, ExcerciseActivity.class);
    spec = tabHost.newTabSpec("excercises").setIndicator("Excercises",
                      res.getDrawable(R.drawable.ic_tab_albums))
                  .setContent(intent);
    tabHost.addTab(spec);

    intent = new Intent().setClass(this, ProgramsActivity.class);
    spec = tabHost.newTabSpec("programs").setIndicator("Programs",
                      res.getDrawable(R.drawable.ic_tab_songs))
                  .setContent(intent);
    tabHost.addTab(spec);

    intent = new Intent().setClass(this, LogActivity.class);
    spec = tabHost.newTabSpec("mealplans").setIndicator("Meal Plans",
                      res.getDrawable(R.drawable.ic_tab_songs))
                  .setContent(intent);
    tabHost.addTab(spec);

    intent = new Intent().setClass(this, BodyMActivity.class);
    spec = tabHost.newTabSpec("bodymeasurements").setIndicator("Body Measurements",
                      res.getDrawable(R.drawable.ic_tab_songs))
                  .setContent(intent);
    tabHost.addTab(spec);

    intent = new Intent().setClass(this, MealPlanActivity.class);
    spec = tabHost.newTabSpec("mealplan").setIndicator("Meal Plan",
                      res.getDrawable(R.drawable.ic_tab_songs))
                  .setContent(intent);
    tabHost.addTab(spec);
    tabHost.setCurrentTab(2);
}
}
  • 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-29T23:08:21+00:00Added an answer on May 29, 2026 at 11:08 pm

    Why couldn’t you just make the visiblity of unwanted tabs “GONE”?

    You can make the side tabs GONE or VISIBLE when scrolling from side to side.

    By view.setVisibility=GONE; or view.setVisibility=VISIBLE;

    If you do viewA GONE, it will take no place. All other views behave themselves as if viewA didn’t exist. Listen to scrolling and when there is place for showing right tabs, show them, and hide the left ones. And vice versa.

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

Sidebar

Related Questions

I am trying to set up CSS Tabs and I'd like them to be
I have this set of tabs in css: /*tabs*/ .tabs { position: relative; min-height:
I have custom javascript code for tabs which works fine, but Im trying to
I'm trying to set my Tab2 as the initially selected tab using ActionBarShelock but
I'm trying to set up an accordian style list of tabs where I can
I'm trying to do the following thing: I have a TabControl with several tabs.
Background: I'm trying to implement a tab control. The tabs are as follows: |
I am trying to diagnose this problem. TAB creates 4 spaces instead of a
I have application like where i can create dynamic tabs. and delete cross bar
I'm trying to set up a Tab Bar Application as my root controller, and

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.