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

The Archive Base Latest Questions

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

I have a main activity with this layout file: <?xml version=1.0 encoding=utf-8?> <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android

  • 0

I have a main activity with this layout file:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_height="fill_parent"
  android:layout_width="fill_parent"
  android:orientation="vertical"
  android:id="@+id/container"
  >
    <LinearLayout
        android:layout_height="wrap_content"
        android:id="@+id/header" 
        android:background="@drawable/logo_bk"
        android:layout_width="fill_parent"
    >

    <Button 
        android:id="@+id/btn_reload"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Reload" 
     />

     <LinearLayout 
        android:id="@+id/LinearLayout01" 
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent" 
        android:gravity="center_vertical|center_horizontal"
     >
        <ImageView 
            android:id="@+id/ImageView01" 
            android:src="@drawable/logo_head" 
            android:scaleType="fitStart" 
            android:adjustViewBounds="true" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" />
     </LinearLayout>

    </LinearLayout>

    <FrameLayout 
        android:id="@+id/center" 
        android:layout_height="fill_parent" 
        android:layout_width="fill_parent" 
        android:layout_weight="1">
    </FrameLayout>

    <LinearLayout 
        android:layout_height="fill_parent" 
        android:layout_width="fill_parent" 
        android:gravity="center" 
        android:id="@+id/footer"
        android:layout_weight="2.6"
        android:background="#ffffff">
    </LinearLayout>

</LinearLayout>

Basically it is composed of a header, a central part (android:id=”@+id/center”) and a footer.
The footer contains four dynamically created buttons. At the end it looks like a TabWidget with the tabs at the bottom.

Each footer’s buttons holds an intent/activity.

The question is: How can I start my activity into the FrameLayout?
For instance TabHost does this:

spec = tabHost
        .newTabSpec(tabTitle.toLowerCase())
        .setIndicator(tabTitle,res.getDrawable(R.drawable.tab_spec))
        .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-14T19:48:13+00:00Added an answer on May 14, 2026 at 7:48 pm

    If you have separate activities for each page you want to display, you’re going to have to extend ActivityGroup for the container activity (the one displaying the tabs), and LocalActivityManager to manage the different embedded activities you want to use.

    It’s kind of complicated, and not documented. I had to read the sourcecode for TabHost.

    Search for class IntentContentStrategy.

    Basically, the idea is that you have a container view, and you use LocalActivityManager to load the activity, get it’s View, and place it inside the container view.

    Excerpt from TabHost.java:

        public View getContentView() {
            if (mLocalActivityManager == null) {
                throw new IllegalStateException("Did you forget to call 'public void setup(LocalActivityManager activityGroup)'?");
            }
            final Window w = mLocalActivityManager.startActivity(
                    mTag, mIntent);
            final View wd = w != null ? w.getDecorView() : null;
            if (mLaunchedView != wd && mLaunchedView != null) {
                if (mLaunchedView.getParent() != null) {
                    mTabContent.removeView(mLaunchedView);
                }
            }
            mLaunchedView = wd;
    
            // XXX Set FOCUS_AFTER_DESCENDANTS on embedded activities for now so they can get
            // focus if none of their children have it. They need focus to be able to
            // display menu items.
            //
            // Replace this with something better when Bug 628886 is fixed...
            //
            if (mLaunchedView != null) {
                mLaunchedView.setVisibility(View.VISIBLE);
                mLaunchedView.setFocusableInTouchMode(true);
                ((ViewGroup) mLaunchedView).setDescendantFocusability(
                        FOCUS_AFTER_DESCENDANTS);
            }
            return mLaunchedView;
        }
    

    Note: there is a lot of tweaking and weird stuff you have to do to get this stuff to work (notice the bug they reference in the comment there), which is probably why it’s not documented.

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

Sidebar

Ask A Question

Stats

  • Questions 385k
  • Answers 385k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Well, for the sake of completion, and as per my… May 14, 2026 at 11:23 pm
  • Editorial Team
    Editorial Team added an answer I assume that your grid is a gridview. Than it… May 14, 2026 at 11:23 pm
  • Editorial Team
    Editorial Team added an answer There is no special metadata with Git, beside the commit… May 14, 2026 at 11:23 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.