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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:53:18+00:00 2026-05-23T03:53:18+00:00

I have a question about the implementation of a ListView layout within a tab

  • 0

I have a question about the implementation of a ListView layout within a tab layout.

When we are implementing this where we have a Custom title bar underneath which is a Tab Layout and within each Tab layout is a List View , should the main activity be a extension of ListView or should it be a extension of Tab View ? Can it be List View ?

The reason is that I’ve created a ListView properly functioning and I want to expand on it by using the list as a template and adding Tabs (categories) which branches into more of such lists. I’ve done it using ListView and seems like addition of tabs would require that i rewrite my whole code by extending tabview. Is there any way i can make use of ListView while implementing my tabs ?

I have noticed that there is no tutorial on how to implement these 2 views/layouts together, anyone has any links and directions ?

  • 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-23T03:53:19+00:00Added an answer on May 23, 2026 at 3:53 am

    I’ve got an example of this in some code I wrote a while ago.

    What I needed was also a list inside of a tab. So the driver for this is the tab that has other activities inside it. You add TabSpec’s that have the Intent of the ListActivity to the TabHost.

    This is the layout for the tab:

    <?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="fill_parent"
            android:padding="5dp">
            <TabWidget
                android:id="@android:id/tabs"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                />
            <FrameLayout
                android:id="@android:id/tabcontent"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:padding="5dp" />
        </LinearLayout>
    </TabHost>
    

    Then this is the layout for one of the list views in the tab:

    <?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">
    
        <ListView android:id="@+id/android:list"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"/>
        <TextView android:id="@+id/android:empty"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:text="@string/no_items"/>
    </LinearLayout>
    

    And this is the code for the tab itself:

    public class

    MyTabActivity extends TabActivity {
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
                setContentView(R.layout.my_tabs);
                Bundle bundle = getIntent().getExtras();
    
                TabHost tabHost = getTabHost();
                TabHost.TabSpec spec;
                Intent intent;
    
                intent = new Intent().setClass(this, MyListActivity.class);
                spec = tabHost  .newTabSpec("some_things")
                                .setIndicator("Some")
                                .setContent(intent);
                tabHost.addTab(spec);
    
                intent = new Intent().setClass(this, MyOtherActivity.class);
                spec = tabHost  .newTabSpec("top_things")
                                .setIndicator("Top")
                                .setContent(intent);
                tabHost.addTab(spec);
    
    
                tabHost.getTabWidget().getChildAt(0).getLayoutParams().height = 35;
                tabHost.getTabWidget().getChildAt(1).getLayoutParams().height = 35;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

(this is related to another question about implementation on iPhone) I have a large
I have question about NSView: Imagine a Custom View where the mouseDown, mouseDrag and
I have a question about locking. This doesn't have to be only about record
I have a question about using new[] . Imagine this: Object.SomeProperty = new[] {string1,
I have a question about this question . I posted a reply there but
I have a question about efficient implementation. Lets say I have two arrays: One
I have a question about coroutine implementation. I saw coroutine first on Lua and
I have a question about the SQL standard which I'm hoping a SQL language
This is more a question about what's the best practice in implementing this. I
i have a conceptual question about Front controller implementation in php. Most of the

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.