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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:18:54+00:00 2026-06-17T12:18:54+00:00

I have a list view and each item is rendered as follows <?xml version=1.0

  • 0

I have a list view and each item is rendered as follows

<?xml version="1.0" encoding="utf-8"?>
<!--  Single List Item Design -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"       
        android:layout_height="?android:attr/listPreferredItemHeight"
        android:padding="6dip">

   <ImageView  
        android:id="@+id/projectImage"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_marginRight="6dip"
        android:src="@drawable/project_icon" 
        android:contentDescription = "@string/projectIcon" />       

   <LinearLayout
        android:id="@+id/projectDetails"
        android:orientation="vertical"
        android:layout_width="0dip"
        android:layout_weight="1"
        android:layout_height="0dip">    

   <TextView
        android:id="@+id/topText"
        android:layout_width="fill_parent"
        android:layout_height="0dip"
        android:padding="10dip"
        android:textSize="16sp"
        android:textStyle="bold"        
        android:textColor="@color/text_color"
        android:gravity="center_vertical" />   

   <TextView
            android:id="@+id/bottomText"
            android:layout_width="fill_parent"
            android:layout_height="0dip"                
            android:paddingLeft="10dip"                
            android:textSize="14sp"         
            android:singleLine="true"           
            android:textColor="@color/locationText_color"
            android:ellipsize="marquee" />
   </LinearLayout>   
</LinearLayout>

But my listview is not rendered properly the list item is too short and it doesnt show any content See below

enter image description here

I do use custom styles. I also tried changing

android:layout_height="?android:attr/listPreferredItemHeight"

To

android:layout_height="100dip"

but it didnt work.

Can anyone help please.

  • 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-17T12:18:55+00:00Added an answer on June 17, 2026 at 12:18 pm

    First, as I said in my comment, you should always use this version of the inflate() method when you inflate the row layout file so you setup the right LayoutParams for the row view:

    inflater.inflate(R.layout.row_layout, parent, false)
    

    Regarding the two TextViews not appearing, I’m not sure how exactly do you want them to be placed. Here is what I think:

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="fill_parent"       
            android:layout_height="?android:attr/listPreferredItemHeight"
            android:padding="6dip">
    
       <ImageView  
            android:id="@+id/projectImage"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_marginRight="6dip"
            android:src="@drawable/project_icon" 
            android:contentDescription = "@string/projectIcon" />       
    
       <LinearLayout
            android:id="@+id/projectDetails"
            android:orientation="vertical"
            android:layout_width="0dip"
            android:layout_weight="1"
            android:layout_height="fill_parent">    
    
       <TextView
            android:id="@+id/topText"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:padding="10dip"
            android:textSize="16sp"
            android:textStyle="bold"        
            android:textColor="@color/text_color"
            android:gravity="center_vertical" />   
    
       <TextView
                android:id="@+id/bottomText"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"                
                android:paddingLeft="10dip"                
                android:textSize="14sp"         
                android:singleLine="true"           
                android:textColor="@color/locationText_color"
                android:ellipsize="marquee" />
       </LinearLayout>   
    </LinearLayout>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a list view that displays a collection of items, each item has
I have implemented a list view. Each item in my list view has two
I have a list view in android. And in each list item, user can
I have a Custom List View where each item in the List contains a
In my application i have a listView. each item of the list view contains
I want to have color indicators for each item in the list view in
I have a ListView with multiple checkboxes (one for each list item). What would
I have a list view with 10 columns and I want each row to
I have a list view with over 100 items. Each of these items show
I have created a custom list view, each row has it's own custom selector,

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.