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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:42:47+00:00 2026-06-03T09:42:47+00:00

I am sure it needs a simple flag but I am not finding the

  • 0

I am sure it needs a simple flag but I am not finding the correct one, spent at least 2 hours to find a correct solution. Hope to get help from you guru’s.
I am trying to create a two tab layout using fragmentActivity. I want to give 50% screen space to each tab. I am able to do that (see attached Screen shot) the next hurdle is I want the tab header e.g. Financial with black bkg should take 50% and Others with gary bkg to take remaining 50%.
enter image description here

I hope I am clear with my question. 🙂

attaching my 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"
    android:background="#EFEFEF" >

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical" >

        <TabWidget
            android:id="@android:id/tabs"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:gravity="center_horizontal" />

        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" >

            <FrameLayout
                android:id="@+id/financial"
                android:layout_width="0dp"
                android:layout_height="0dp"
                android:layout_weight="0"
                android:tag="@string/financial" />

            <FrameLayout
                android:id="@+id/other"
                android:layout_width="fill_parent"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:tag="@string/others" />
        </FrameLayout>
    </RelativeLayout>

</TabHost>


**The calling xml would be**

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

    <ListView
        android:id="@+id/listView1"
        android:layout_width="fill_parent"
        android:layout_height="48dp"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/textView1" >
    </ListView>

    <fragment
    class="com.......android.activity.AccountsTab"
        android:id="@+id/tabs_fragment"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" 
        android:layout_centerInParent="true"/>
</RelativeLayout>

adding tab.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="150dp"
    android:layout_height="@dimen/tab_height"
    android:background="@drawable/tab_selector"
    android:gravity="center_horizontal"
    android:orientation="horizontal"
    android:padding="@dimen/tab_padding"
    android:weightSum="0.5" >

    <TextView
        android:id="@+id/text"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="0.5"
        android:gravity="center_horizontal|center_vertical"
        android:textColor="@drawable/tab_text_selector"
        android:textSize="@dimen/text_default"
        android:textStyle="italic" />

</RelativeLayout>
  • 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-06-03T09:42:48+00:00Added an answer on June 3, 2026 at 9:42 am

    I think you should do it like this.

    <?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="fill_parent">
        <TabHost
            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"
                >
    
                <TabWidget
                    android:id="@android:id/tabs"
                    android:orientation="horizontal"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="0"
                    />
    
                <FrameLayout
                    android:id="@android:id/tabcontent"
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:layout_weight="0"/>
    
                <FrameLayout
                    android:id="@+android:id/realtabcontent"
                    android:layout_width="fill_parent"
                    android:layout_height="0dp"
                    android:layout_weight="1"/>
            </LinearLayout>
        </TabHost>
    </LinearLayout>
    

    With this you can add as many tabs as you want.

    enter image description here
    Hope you want this.

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

Sidebar

Related Questions

i am trying to build a simple chat system but I'm not sure what
I'm sure this is simple, but I'm not able to figure out why this
I'm sure this is a simple thing to do but in php I need
I need to write following query in Linq to SQL but not sure what
I'm trying to make a simple xml-editor for some basic but specific needs, the
I have a simple program, which needs to make sure I can connect to
I am sure my question is very simple for some, but I cannot figure
I'm sure this is a really simple, obvious answer, but my brain is fried
Ok, I am sure this is simple, but I am having a senior moment.
It should be simple, but it's not. I have a library that is hoping

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.