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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:31:43+00:00 2026-05-30T16:31:43+00:00

I have a listview which contains custom rows. When I show the listview with

  • 0

I have a listview which contains custom rows. When I show the listview with it’s custom rows, all the rows only have a height of about 2px. I tried it on an Android 4.0 device, and on an emulator which has Android 2.x. I added a screenshot of the problem.
Prepare, here comes quite a lot of code:

This is my code for my custom row:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="105px"
    android:background="#fff"
    android:orientation="vertical"
    android:paddingLeft="15dp" >

    <TextView
        android:id="@+id/toptext"
        android:layout_width="fill_parent"
        android:layout_height="0dip"
        android:layout_alignParentBottom="true"
        android:layout_alignParentTop="true"
        android:layout_marginTop="8px"
        android:gravity="top"
        android:text="name"
        android:textColor="#322a37"
        android:textSize="11pt" />

</RelativeLayout>

The code in my activity:

public class ListActivity extends BaseActivity {
    private ArrayList<User> m_items;
    private ObjectAdapter m_adapter;
    private EditText textSearch;
    private ListView listView;

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.list);

        textSearch = (EditText) findViewById(R.id.textSearch);
        listView = (ListView) findViewById(R.id.listView);

        m_items = new ArrayList<User>();

        //(fill m_items, goes well)

        this.m_adapter = new ObjectAdapter(this, R.layout.row_text, m_items);
        listView.setAdapter(this.m_adapter);

    }

    private class ObjectAdapter extends ArrayAdapter<User> {

        private ArrayList<User> items;

        @SuppressWarnings("unchecked")
        public ObjectAdapter(Context context, int textViewResourceId,
                ArrayList<User> items) {
            super(context, textViewResourceId, items);
            this.items = items;
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            View v = convertView;
            if (v == null) {
                LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                v = vi.inflate(R.layout.row_text, null);
            }
            User u = items.get(position);
            if (u != null) {
                TextView top = (TextView) v.findViewById(R.id.toptext);

                if (top != null) {
                    top.setText(u.getName());
                }
            }
            return v;
        }
    }
}

The screenshot of the result:

Anyone any clue why this is happening?

  • 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-30T16:31:44+00:00Added an answer on May 30, 2026 at 4:31 pm

    The line:

    android:layout_height="0dip"
    

    does not strike me as being particularly clever.

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

Sidebar

Related Questions

Hallo all, I have a ListView which contains a Button in each line. The
Hallo all, I have a ListView, which contains an EditText in each of it's
I have a listactivity which contains a listview. i want to show another layout
I have a custom listview which changes size when one of the rows is
I have one custom ListView which contains one ImageView and one TextView, and I
I have made a custom listView which which extends ListActivity and each row contains
I have a ListView which uses a custom adapter to display rows of data.
I have a ListView which potentially contains thousands of rows, generated by a CursorAdapter.
I have a listview that contains values from webservice.Each page contains only 10 listitems
i have a ListView which contains objects bound from an collection. The representation of

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.