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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T15:26:02+00:00 2026-05-15T15:26:02+00:00

I use the following main.xml for my app. <?xml version=1.0 encoding=utf-8?> <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent

  • 0

I use the following main.xml for my app.

<?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:id="@+id/toplinear">
    <LinearLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:id="@+id/linear">
        <Button  
            android:layout_width="fill_parent" 
            android:layout_height="wrap_content" 
            android:text="Previous"
            android:id="@+id/previous"
            android:layout_weight="1"
            />
        <Button  
            android:layout_width="fill_parent" 
            android:layout_height="wrap_content" 
            android:text="Next"
            android:id="@+id/next"
            android:layout_toRightOf="@id/previous"
            android:layout_weight="1"
            />
    </LinearLayout>
    <ListView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" 
        android:id="@+id/android:list"
        android:layout_weight="10"
        />

</LinearLayout>

I want to have 2 buttons at the top, previous and next and my listview with custom adapter below it. Few days ago I had only my ListView showing, going over the buttons. Now I seem to be stuck on the other side, where my listview doesn’t show while my buttons do.

My activity extends on ListActivity and uses this code to fill it with a customadapter.

ListView lv = getListView();
lv.setAdapter(new MyCustomAdapter(this, R.layout.custom_list, nameResults));

    public class MyCustomAdapter extends ArrayAdapter<String> {
        private String[] nameResults;
        private Context context;

        public MyCustomAdapter(Context context, int textViewResourceId,
                String[] names) {
            super(context, textViewResourceId, names);
            this.context = context;
            nameResults = names;
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            View row = convertView;
            if (row == null) {
                LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                row = inflater.inflate(R.layout.custom_list, parent, false);
            }

            TextView label = (TextView) row.findViewById(R.id.Name);
            label.setText(nameResults[position]);
            TextView descr = (TextView) row.findViewById(R.id.Description);
            descr.setText(linkedResults.get(nameResults[position]));

            return row;
        }
    }

I tried using “lv.addHeaderView(previous);” but that only gave me vague ClassCastExceptions about LayoutParams.

I think my problem is currently in my main.xml, as the Layout tab in Eclipse of it won’t show the ListView either. It knows its there as it shows up in the outline tab, but the visual representation doesn’t give it a red outline when I select it.

For completeness, my custom_list (aka row) layout xml:

<?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"
  android:background="#ffffff"
>
  <TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:id="@+id/Name"
    android:textColor="#000000"
    android:textStyle="bold"
  />
  <TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:id="@+id/Description"
    android:textColor="#000000"
  />

</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-05-15T15:26:02+00:00Added an answer on May 15, 2026 at 3:26 pm

    I’m modified your main.xml a bit – added orientation and took off the layout_weight for the listview – hopefully this fixes that problem.

    <?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:orientation="vertical"
        android:id="@+id/toplinear">
        <LinearLayout
          xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:orientation="horizontal"
          android:id="@+id/linear">
            <Button  
                android:layout_width="fill_parent" 
                android:layout_height="wrap_content" 
                android:text="Previous"
                android:id="@+id/previous"
                android:layout_weight="1"
                />
            <Button  
                android:layout_width="fill_parent" 
                android:layout_height="wrap_content" 
                android:text="Next"
                android:id="@+id/next"
                android:layout_toRightOf="@id/previous"
                android:layout_weight="1"
                />
        </LinearLayout>
        <ListView
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" 
            android:id="@+id/android:list"
            />
    
    </LinearLayout>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer This is as basic as it gets: Start a MVC2… May 16, 2026 at 12:04 pm
  • Editorial Team
    Editorial Team added an answer First off, don't depend on mb_detect_encoding. It's not great at… May 16, 2026 at 12:04 pm
  • Editorial Team
    Editorial Team added an answer You'll have to parse the strings into Date() objects, which… May 16, 2026 at 12:04 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

Related Questions

I'm writing my first android app (I'm a noob at android, but decent at
I have looked at many examples for validating an XML file against a DTD,
I've created a custom component in Flex, and I've created it from the main
This is a continuation of the question here: JBoss - does app have to
I have a WinForms .NET app that, according to the Vista Task Manager with
I've created an AS class to use as a data model, shown here: package
I'm working with an XSL stylesheet, and I'm trying to use the method shown
I generally use List<T> for collections. But if I need a fast lookup on
Following situation: Parent: namespace Base; /** @Entity @Table(name=section) */ class Section extends Skeleton {
I have experienced a strange problem in windows vista and above. When I use

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.