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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:17:27+00:00 2026-05-26T19:17:27+00:00

I am working on an application where i have to use android tabhost. I

  • 0

enter image description here

I am working on an application where i have to use android tabhost. I am facing a problem using it, as layout of my activity does not show up properly under the tab. The layout of the activity shows up only in the upper half of the emulator screen and bottom half remain black, while when i saw its xml in design view it depicts the required design.

xml is added below as myscreen.xml:

<LinearLayout
 xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent"
 android:background="@color/gray"
 android:orientation="vertical">
 <LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_gravity="center_vertical"
    android:orientation="vertical"
    android:gravity="center">
    <ImageView
        android:id="@+id/button_twitter"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/twitter_login_unpressed" />
    <ImageView
        android:id="@+id/button_separator"
        android:layout_width="wrap_content"
        android:layout_height="30px"
        android:background="@color/gray" />
    <ImageView
        android:id="@+id/button_facebook"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/facebook_login_unpressed" />
</LinearLayout>

and the relevant activity just contains the following code in onCreate:

protected void onCreate(Bundle savedInstanceState) {

    Log.e("Now", "onCreate");
    super.onCreate(savedInstanceState);
    setContentView(R.layout.myscreen); 

}

i am unable to figure out why the whole layout under the tab is not shown properly, and tabActivity just has and intent to this activity, there is nothing complex in there…It contains the following code:

public class InfoTabActivity extends TabActivity {

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.infotablayout);
    Resources res = getResources();
    TabHost tabHost = getTabHost(); 
    TabHost.TabSpec spec;
    Intent intent;

    intent = new Intent().setClass(this, myActivity.class);
    spec = tabHost.newTabSpec("settings").setIndicator("", res.getDrawable(R.drawable.today_unpressed)).setContent(intent);
    tabHost.addTab(spec);



    tabHost.setCurrentTab(0);
}

}

What can possibly be the problem? Any help is appreciated.

infotablayout.xml contains this code:

<?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="wrap_content"
        android:padding="5dp">
        <TabWidget
            android:id="@android:id/tabs"
            android:layout_width="fill_parent"
            android:layout_height="45px" />
        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:padding="5dp" />
    </LinearLayout>
</TabHost>
  • 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-26T19:17:28+00:00Added an answer on May 26, 2026 at 7:17 pm

    The problem is most likely in your infotablayout.xml – the FrameLayout you use for TabContent most likely has the attribute layout_height="wrap_content". (Maybe you could post that xml-file too, so we can have a look).

    Edit

    The LinearLayout that holds your TabWidget and the FrameLayout has its height set to wrap_content which is why your layout wraps.


    Little off topic, but you should be able to reduce your myscreen.xml file to the following:

    <LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     android:background="@color/gray"
     android:orientation="vertical"
     android:layout_gravity="center_vertical"
     android:gravity="center">
        <ImageView
            android:id="@+id/button_twitter"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/twitter_login_unpressed"
            android:layout_marginBottom="15dp" />
        <ImageView
            android:id="@+id/button_facebook"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/facebook_login_unpressed"
            android:layout_marginTop="15dp" />
    </LinearLayout>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following problem: I am working on an Android application where at
I'm working on Android application which have two different tabhost : Main and Child.
I have am working on a web application that makes use of helper classes.
I am working on an Android application and I have a question. I have
I am a working on android application development. I am using eclipse IDE. I
I have an Android application that makes use of TTS (Text to speech) API.
I'm working on an android application, and I have a drawable that I'm loading
I am developing an android application and have created a tabbed layout for my
I am working towards an android application. I need to use a web service.
I'm working on an application which uses SQLite Database on Android.I have a custom

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.