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

  • Home
  • SEARCH
  • 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 7188523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:06:12+00:00 2026-05-28T19:06:12+00:00

I am newbie in android. I developed an android application that shows 15 tabs.

  • 0

I am newbie in android. I developed an android application that shows 15 tabs. One problem is i can’t see each tab’s title fully. Is it tabs in the android is scrollable.
I use below code to create tabs. looking for better solution

main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<TabHost android:id="@android:id/tabhost" android:layout_width="match_parent" android:layout_height="match_parent">
    <LinearLayout android:layout_width="match_parent" android:id="@+id/linearLayout1" android:layout_height="match_parent" android:orientation="vertical">
        <TabWidget android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@android:id/tabs"></TabWidget>
        <FrameLayout android:layout_width="match_parent" android:layout_height="500px" android:id="@android:id/tabcontent">
            <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab1">
                <TextView android:text="Tab1 Clicked" android:layout_width="wrap_content" android:layout_height="wrap_content" />
            </LinearLayout>
            <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab2">
                <TextView android:text="Tab2 Clicked" android:layout_width="wrap_content" android:layout_height="wrap_content" />                   
            </LinearLayout>
            <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab3">
                <TextView android:text="Tab3 Clicked" android:layout_width="wrap_content" android:layout_height="wrap_content" />                   
            </LinearLayout>
            <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab4">
                <TextView android:text="Tab4 Clicked" android:layout_width="wrap_content" android:layout_height="wrap_content" />                
            </LinearLayout>
            <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab5">
                <TextView android:text="Tab5 Clicked" android:layout_width="wrap_content" android:layout_height="wrap_content" />
            </LinearLayout>
            <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab6">
                <TextView android:text="Tab6 Clicked" android:layout_width="wrap_content" android:layout_height="wrap_content" />
            </LinearLayout>
            <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab7">
                <TextView android:text="Tab7 Clicked" android:layout_width="wrap_content" android:layout_height="wrap_content" />
            </LinearLayout>                
            <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab8">
                <TextView android:text="Tab8 Clicked" android:layout_width="wrap_content" android:layout_height="wrap_content" />
            </LinearLayout>                
            <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab9">
                <TextView android:text="Tab9 Clicked" android:layout_width="wrap_content" android:layout_height="wrap_content" />
            </LinearLayout>                
            <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab10">
                <TextView android:text="Tab10 Clicked" android:layout_width="wrap_content" android:layout_height="wrap_content" />
            </LinearLayout>                
            <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab11">
                <TextView android:text="Tab11 Clicked" android:layout_width="wrap_content" android:layout_height="wrap_content" />
            </LinearLayout>                
            <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab12">
                <TextView android:text="Tab12 Clicked" android:layout_width="wrap_content" android:layout_height="wrap_content" />
            </LinearLayout>                
            <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab13">
                <TextView android:text="Tab13 Clicked" android:layout_width="wrap_content" android:layout_height="wrap_content" />
            </LinearLayout>                
            <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab14">
                <TextView android:text="Tab14 Clicked" android:layout_width="wrap_content" android:layout_height="wrap_content" />
            </LinearLayout>                
            <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab15">
                <TextView android:text="Tab15 Clicked" android:layout_width="wrap_content" android:layout_height="wrap_content" />
            </LinearLayout>
        </FrameLayout>
    </LinearLayout>
</TabHost>
</LinearLayout>

activity class

package mtx.samples;

import android.app.AlertDialog;
import android.app.TabActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;

public class NewTabAppActivity extends TabActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    final AlertDialog.Builder ad = new AlertDialog.Builder(this);

    TabHost tabHost = getTabHost();
    // tab1
    TabSpec ts1 = tabHost.newTabSpec("Tab1");
    ts1.setIndicator("Tab 1", getResources().getDrawable(R.drawable.rss));
    ts1.setContent(R.id.tab1);
    tabHost.addTab(ts1);

    // tab2
    TabSpec ts2 = tabHost.newTabSpec("Tab2");
    ts2.setIndicator("Tab 2");
    ts2.setContent(R.id.tab2);
    tabHost.addTab(ts2);

    // tab3
    TabSpec ts3 = tabHost.newTabSpec("Tab3");
    ts3.setIndicator("Tab 3");
    ts3.setContent(R.id.tab3);
    tabHost.addTab(ts3);

    // tab4
    TabSpec ts4 = tabHost.newTabSpec("Tab4");
    ts4.setIndicator("Tab 4");
    ts4.setContent(R.id.tab4);
    tabHost.addTab(ts4);

    // tab5
    TabSpec ts5 = tabHost.newTabSpec("Tab5");
    ts5.setIndicator("Tab 5");
    ts5.setContent(R.id.tab5);
    tabHost.addTab(ts5);

    // tab6
    TabSpec ts6 = tabHost.newTabSpec("Tab6");
    ts6.setIndicator("Tab 6");
    ts6.setContent(R.id.tab6);
    tabHost.addTab(ts6);

    // tab7
    TabSpec ts7 = tabHost.newTabSpec("Tab7");
    ts7.setIndicator("Tab 7");
    ts7.setContent(R.id.tab7);
    tabHost.addTab(ts7);

    // tab8
    TabSpec ts8 = tabHost.newTabSpec("Tab8");
    ts8.setIndicator("Tab 8");
    ts8.setContent(R.id.tab8);
    tabHost.addTab(ts8);

    // tab9
    TabSpec ts9 = tabHost.newTabSpec("Tab9");
    ts9.setIndicator("Tab 9");
    ts9.setContent(R.id.tab9);
    tabHost.addTab(ts9);

    // tab10
    TabSpec ts10 = tabHost.newTabSpec("Tab10");
    ts10.setIndicator("Tab 10");
    ts10.setContent(R.id.tab10);
    tabHost.addTab(ts10);

    // tab11
    TabSpec ts11 = tabHost.newTabSpec("Tab11");
    ts11.setIndicator("Tab 11");
    ts11.setContent(R.id.tab11);
    tabHost.addTab(ts11);

    // tab12
    TabSpec ts12 = tabHost.newTabSpec("Tab12");
    ts12.setIndicator("Tab 12");
    ts12.setContent(R.id.tab12);
    tabHost.addTab(ts12);

    // tab13
    TabSpec ts13 = tabHost.newTabSpec("Tab13");
    ts13.setIndicator("Tab 13");
    ts13.setContent(R.id.tab13);
    tabHost.addTab(ts13);

    // tab14
    TabSpec ts14 = tabHost.newTabSpec("Tab14");
    ts14.setIndicator("Tab 14");
    ts14.setContent(R.id.tab14);
    tabHost.addTab(ts14);

    // tab15
    TabSpec ts15 = tabHost.newTabSpec("Tab15");
    ts15.setIndicator("Tab 15");
    ts15.setContent(R.id.tab15);
    tabHost.addTab(ts15);


    ad.setTitle("NewTabApp");
    ad.setNeutralButton("OK", null );

    Button btnSendSettings = (Button)findViewById(R.id.btnSendSettings);
    btnSendSettings.setOnClickListener( new View.OnClickListener() {

        public void onClick(View v) {
            ad.setMessage("Send Settings button Clicked");
            ad.show();
        }
    });

    Button btnClose = (Button)findViewById(R.id.btnClose);
    btnClose.setOnClickListener( new View.OnClickListener() {

        public void onClick(View v) {
            System.exit(-1);
        }
    });

    Button btnSave = (Button)findViewById(R.id.btnSave);
    btnSave.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            ad.setMessage("Save button Clicked");
            ad.show();              
        }
    });

    Button btnSend = (Button)findViewById(R.id.btnSend);
    btnSend.setOnClickListener( new View.OnClickListener() {

        public void onClick(View v) {
            ad.setMessage("Send button Clicked");
            ad.show();              
        }
    });
}
 }
  • 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-28T19:06:14+00:00Added an answer on May 28, 2026 at 7:06 pm

    you can make scrolling tabs in android using HorizontalScrollView in your layout xml file .

    <HorizontalScrollView android:layout_width="fill_parent"
                              android:layout_height="wrap_content"
                              android:fillViewport="true"
                              android:scrollbars="none">
          <TabWidget android:id="@android:id/tabs"
                     android:layout_width="fill_parent"
                     android:layout_height="wrap_content"/>
        </HorizontalScrollView>
    

    For reference go through the link :

    scrolling-tabs-android

    Hope this will help you to solve your issue.

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

Sidebar

Related Questions

Hi am newbie to android development. I had created one application where i need
I'm a newbie on Android development platform. Can a third party application (say the
Newbie here...can I write one program which incorporates .NET LINQ and also various Java
I am newbie in android. I had planned to develop an application which divides
I am an Android Newbie and I'm developing Go game application for android. I'm
I am newbie to android. I have client server based application. Server keeps on
I'm rather newbie on Android, and I'm working on a simple application to get
what's the best database we can use to develop application for mono android? best
I am a newbie in Android and currently I am designing an application where
I'm a newbie android developer, I'm trying to develop an application; a background service

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.