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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:55:30+00:00 2026-06-18T08:55:30+00:00

I am learning to use the Hierarch Viewer tool , but meanwhile any hint

  • 0

I am learning to use the Hierarch Viewer tool, but meanwhile any hint on why below layout is not rendering correctly is appreciated.

I am trying to render an “html” table view. The content (table body) is rendered correctly with a custom list adapter. This works. But, when I add a textView (text_test below) to use as header, the list is not rendered anymore. I could see the code flow through my adapter (populate view holder, etc), but on screen I only see the Title text, no listView. I used to use FrameLayout (as noted in the comment), but then switched to LinearLayout.

Thanks.

@Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.my_list_view, container,
                false);
        ListView lv = (ListView)view.findViewById(R.id.my_list_view_one);
        // Tell the list view which view to display when the list is empty
        //lv.setEmptyView(getActivity().findViewById(R.id.my_list_view_empty));

        // Set up the adapter
        mCustomAdapter = new ListAdapterMyType(inflater, new ArrayList<MyType>());
        lv.setAdapter(mCustomAdapter);
        return  view;
    }

my_list_view.xml

    <?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:layout_width="match_parent"
              android:layout_height="match_parent">

    <!-- The frame layout is here since we will be showing either
the empty view or the list view.  -->
    <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="0dip"
            android:layout_weight="1">

        <TextView
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:text="@string/text_test"/>

        <ListView
                android:id="@+id/my_list_view_one"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:drawSelectorOnTop="false"/>

        <!-- Here is the view to show if the list is emtpy -->
        <TextView android:id="@+id/my_list_view_empty"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:text="@string/list_no_items"
                  android:visibility="gone"/>

    </LinearLayout>
    </LinearLayout>
  • 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-18T08:55:31+00:00Added an answer on June 18, 2026 at 8:55 am

    But, when I add a textView (text_test below) to use as header, the list is not rendered anymore.

    The TextView is set to match_parent in both the width and height, so it will fill the entire screen… To put a TextView above your ListView try:

    <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="0dip"
            android:orientation="vertical">
    
        <TextView
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:text="@string/text_test"/>
    
        <ListView
                android:id="@+id/my_list_view_one"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:drawSelectorOnTop="false"/>
    
        <!-- Here is the view to show if the list is emtpy -->
        <TextView android:id="@+id/my_list_view_empty"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:text="@string/list_no_items"
                  android:visibility="gone"/>
    
    </LinearLayout>
    

    I removed the outer LinearLayout, since it only had one child it did nothing. I also changed the remaining LinearLayout’s orientation to vertical and set the header TextView height to wrap_content.

    If you want your custom header to scroll with your ListView, use the addHeaderView() method (before calling setAdapter()) instead of a separate TextView in your layout. This approach will also hide the header when the ListView is empty.

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

Sidebar

Related Questions

I am learning to use the Dvorak keyboad layout, but I am not good
I'm just learning to use lazy sequences in Clojure, and I'm not sure what
I'm learning to use Springsource Tool Suite (STS) and the Spring framework for development.
I'm learning to use the PHP interactive shell, but I'm having trouble with multi-line
I'm learning to use epoll function. But my OS X, Mountain Lion doesn't have
I'm learning to use Mercurial, and its learning curve is pretty straightforward. But one
I am currently learning to use Springy which is a force directed graph layout
I'm learning to use ImageMagick, but I'm having trouble when I try to generate
I'm learning to use CSS3 3D transforms, but I'm having trouble keeping elements which
I am learning to use polymorphism in C#, but cannot figure out this one.

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.