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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:39:31+00:00 2026-05-27T10:39:31+00:00

I have a ListActivity with custom rows, icons, TextViews, etc. So I am not

  • 0

I have a ListActivity with custom rows, icons, TextViews, etc. So I am not using the XML ListView resource. I do have a scrolling list from an Array, and a header on top. I just want the header not to scroll and be persistent on the screen. Here is my code:

ListDisplay.java

View header = getLayoutInflater().inflate(R.layout.header, null, false);
    ListView listView = getListView();
    listView.addHeaderView(header, null, false);
    setListAdapter(new MyArrayAdapter(this, names));

header.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#008800"
android:orientation="vertical" >

<TextView
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:layout_margin="15dp"
    android:clickable="false"
    android:text="n/a"
    android:textColor="#fff"
    android:textSize="25dp" />

<TextView
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:clickable="false"
    android:text="n/a"
    android:textColor="#fff"
    android:textSize="12dp" />
</TextView>
</LinearLayout>

rowlayout.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/list_selector" >

<ImageView
    android:id="@+id/icon"
    android:layout_width="28dp"
    android:layout_height="28dp"
    android:layout_marginTop="15dp"
    android:layout_marginLeft="10dp"
    android:layout_marginRight="10dp"
    android:src="@drawable/tv" >
</ImageView>

<TextView
    android:id="@+id/label"
    android:layout_width="wrap_content"
    android:layout_height="50dp"
    android:layout_marginTop="14dp"
    android:text="@+id/label"
    android:textColor="#000"
    android:textSize="23dp" >
</TextView>

</LinearLayout>

I don’t think I need to display the ArrayAdapter Java code?

  • 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-27T10:39:31+00:00Added an answer on May 27, 2026 at 10:39 am

    Create a layout that will include header view and list view. ListView items should be set up using Adapter. There are quite a few tutorials on the subject found on the web such as this one

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

Sidebar

Related Questions

I have created a custom listview that is populated using a row.xml file. Each
Note that my activity is NOT extending ListActivity; just Activity. I have a list
I have a listview which contains custom rows. When I show the listview with
I have a ListActivity with a ListView populated onStart with data from a database.
I have created a custom ListActivity that shows a list of skills and buttons
I have made a custom listView which which extends ListActivity and each row contains
I have done my custom ListView, the xml was following: <?xml version=1.0 encoding=utf-8?> <LinearLayout
I currently have a custom listview where each item on the list contains two
I have a small custom dialog in wich I have a ListView with id:list.
Im opening a ListActivity with an xml called list with a ListView named list.

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.