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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:10:38+00:00 2026-05-20T05:10:38+00:00

after spending 2 solid days searching for an answer, I would like to ask

  • 0

after spending 2 solid days searching for an answer, I would like to ask for help about the following behaviour.

I’m trying to code a simple tabhost application on Android, with a layout per activity.
I’ve designed my layout so that the tabwidget appears at the bottom of the screen.

On the first tab, I’m trying to insert a simple 2 lines ListView. My problem is that the ListView is well on the bottom, but half of it is hidden behind the tabwidget. I would like to understand how to make my ListView to be displayed just above the tabwidget.

Here is my main.xml :

    <?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">
    <RelativeLayout
        android:layout_height="fill_parent"
        android:layout_width="fill_parent">

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

       <TabWidget
            android:id="@android:id/tabs"
            android:layout_alignParentBottom="true"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" />
    </RelativeLayout>

</TabHost>

Here is my main app class :

public class TestTabWidget 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

        intent = new Intent().setClass(this, AActivity.class);

        spec = tabHost.newTabSpec("artists").setIndicator("Tab A",
                          res.getDrawable(R.drawable.ic_tab_a))
                      .setContent(intent);
        tabHost.addTab(spec);


        tabHost.setCurrentTab(0);
    }

}

Here is my Activity code :

public class AActivity extends Activity {

ListView lvListe;

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.a_layout);
        lvListe = (ListView)findViewById(R.id.lvListe);
        lvListe.setBackgroundResource(R.layout.tables);

        String[] listeStrings = {"Value 1","Value 2"};

        lvListe.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,listeStrings));

    }
}

Here is my layout for the activity :

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <ListView 
          android:id="@+id/lvListe"
          android:layout_height="wrap_content"
          android:layout_width="wrap_content"
          android:layout_alignParentBottom="true" />
</RelativeLayout>

Thanks to anyone keen to help me I’m just going nuts….

Adam

  • 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-20T05:10:38+00:00Added an answer on May 20, 2026 at 5:10 am

    Try this layout instead for your RelativeLayout section:

    <RelativeLayout
      android:layout_height="fill_parent"
      android:layout_width="fill_parent">
    
      <FrameLayout
        android:id="@android:id/tabcontent"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_above="@android:id/tabs"
        android:padding="5dp" />
    
      <TabWidget
        android:id="@android:id/tabs"
        android:layout_alignParentBottom="true"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />
    </RelativeLayout>
    

    Right now, your FrameLayout is filling the entire space inside the RelativeLayout, as RelativeLayout makes no distinctions about placing items next to each other like LinearLayout does, and allows overlapping. My adjustment tells the layout to fill the space between the widget the the top of that layout.

    Another note about RelativeLayout, the Z-order of the items is determined by the order in XML, that’s why the TabWidget appears on top of the FrameLayout. If you had reversed the order, the TabWidget would not have even been visible!

    Hope that helps!

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

Sidebar

Related Questions

I am new to this after spending 2 days trying to find an answer
After spending a couple of days trying figure out why opencv DFT would give
After spending about 6-8 hours trying to digest the Manacher's algorithm, I am ready
After highlighting text, I would like to obtain the paragraph in which the selected
After spending a lot of time trying to wrap my head around multiprocessing I
After spending several hours today searching and seeing several people having the same issue,
After spending a good 3 to 4 hours on google trying to find any
After spending SEVERAL frustrated hours on this I am asking for your help. I
After spending hours I still cant figure it out. I'm trying to validate an
After spending the best part of 3 hours getting nowhere, i thought i would

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.