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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:41:47+00:00 2026-05-27T00:41:47+00:00

I am creating an application using TabLayout and am having problems with the display

  • 0

I am creating an application using TabLayout and am having problems with the display when using Intents to load different classes.

I tried creating it using the method explained in the Android Development guide seen here

http://developer.android.com/resources/tutorials/views/hello-tabwidget.html

However the problem I am having is, that I want the tabs along the bottom of the application rather than the top which I have done. The problem is that there is not enough space on screen to view the whole application so when I click a new tab and it loads its layout, it goes right through the tabs. I tried adding ScrollView but it doesn’t seem to work.

Any suggestions as to how to fix this so when I load a screen I can scroll up and down the page with my tabs always appearing at the bottom and not have my layout clip through my tabs.

Any help would be much appreciated

Code for my main.xml is

<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" android:background="#92c223">

<LinearLayout android:orientation="vertical"
    android:layout_width="fill_parent" android:layout_height="fill_parent"
    android:padding="5dp">

    <FrameLayout android:id="@android:id/tabcontent"
        android:layout_width="fill_parent" android:layout_height="fill_parent"
        android:padding="5dp" />

</LinearLayout>

<TabWidget android:id="@android:id/tabs"
    android:layout_width="fill_parent" android:layout_height="wrap_content"
    android:layout_gravity="bottom" />
</TabHost>

Also the code I used to swap between tabs in java is

intent = new Intent().setClass(this, tag.class); 
    spec = tabHost.newTabSpec("tag1")
            .setIndicator("tag1", res.getDrawable(R.drawable.icon))
            .setContent(intent);
    tabHost.addTab(spec);

    intent = new Intent().setClass(this, tag2.class);
    spec = tabHost.newTabSpec("tag2")
            .setIndicator("tag2", res.getDrawable(R.drawable.icon2))
            .setContent(intent);
    tabHost.addTab(spec);
  • 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-27T00:41:47+00:00Added an answer on May 27, 2026 at 12:41 am

    Try this

    <?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">
    
        <LinearLayout
            android:orientation="vertical"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:padding="5dp">
    
            <FrameLayout
                android:id="@android:id/tabcontent"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:padding="5dp"
                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>
    
    </TabHost>
    

    The difference is in the FrameLayout, the height is set to wrap_content, where yours is set to fill_parent. Also he applies a layout_weight = 1 on the FrameLayout, and layout_weight = 0 on the TabWidget.

    Taken from here.

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

Sidebar

Related Questions

I am creating an application using AppleScript and I want to display a list
I'm creating an application using the fastcgi library, and their method of printing is
I am creating an torrent application using libtorrent in VS 2008. I tried the
I'm creating an application using the ASP.NET MVC 1 framework in C#, where I
I've been playing around with creating an application using the S#arp Architecture . One
I am creating a WPF Application using VS 2005. I download the add on
I'm creating a database application using ASP.NET and I want to make a Windows
I am creating a windows application using VB.Net and this application will take a
I am creating a simple application using the MVC design pattern where my model
I am creating a web application using zend, here I create an interface from

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.