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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:45:20+00:00 2026-06-08T09:45:20+00:00

I wanted to use a TabHost inside an existing TabHost/TabActivity. So I wanted to

  • 0

I wanted to use a TabHost inside an existing TabHost/TabActivity. So I wanted to get rid of the Activity class and just implement a viewgroup class inheriting from TabHost. However, it seems like it is not possible to use TabHost without a corresponding Activity class – the TabHost and it’s contents just won’t show up when displaying the extended class.

I used the TabHost class and added the linear layout containing the tabs and content containers with the appropriate IDs (android:id/tabs and android:id/tabcontent) from xml.

public class EmitterView : TabHost, TabHost.ITabContentFactory
{
public EmitterView(Context context) :
base(context)
{
Initialize();
}

public EmitterView(Context context, IAttributeSet attrs) :
base(context, attrs)
{
Initialize();
}

private void Initialize()
{
// construct the TAB Host

LayoutInflater inflater = (LayoutInflater)    
this.Context.GetSystemService(Context.LayoutInflaterService);
View view = inflater.Inflate(AndroidFilterEditor.Resource.Layout.EmitterTabHost, null);
this.AddView(view);

this.Setup();

// Create Tabs
TabSpec emitter = this.NewTabSpec("Emitter");
emitter.SetIndicator("Emitter", Resources.GetDrawable(AndroidFilterEditor.Resource.Drawable.ic_tab_artists));
//Intent emitterIntent = new Intent(this.Context, typeof(EmitterActivity));
emitter.SetContent(this);
this.AddTab(emitter);
this.Invalidate();
}

public View CreateTabContent(string tag)
{
EmitterContentView view = new EmitterContentView(this.Context);
return view;
}
}

The Layout definition:

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="5dp">
<FrameLayout
android:id="@android:id/tabcontent"
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="wrap_content"/>
</LinearLayout>

Any idea if this could be possible? This is Mono for Android btw, so the code is in C# obviously.

  • 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-08T09:45:23+00:00Added an answer on June 8, 2026 at 9:45 am

    You can use ActivityGroup to host more than one activity in it and assign tabhost to each of them. Though it gets complicated and is not encouraged. I will suggest you to use Fragments instead of tabhost inside another tabhost.

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

Sidebar

Related Questions

I wanted to use the Twitter API to get the friends status list from
I wanted to use the following code from here: How can I save all
I wanted to use a Rich Text Editor for a text area inside an
I just wanted to use MySQLConnectionStringBuilder to build a connection string and realized that
I wanted to use the var keyword to declare a field in my class
Wanted to use the same URL for a GET/PUT/DELETE/POST for a REST based API,
I wanted to use T4 to generate properties for a partial class. I'm running
I wanted to use boost::thread in my program, but get the following compiler error
I wanted to use ASMifierClassVisitor tool to get the asm code of creating a
I saw the following code, and wanted to use it for a simple activity

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.