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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:19:23+00:00 2026-06-17T05:19:23+00:00

I am probably just misusing the XML, but I’m trying to create a layout

  • 0

I am probably just misusing the XML, but I’m trying to create a layout for a list view row, but I seem to be failing miserably.

I have this:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="100dp"
    android:orientation="vertical"
    android:paddingLeft="20dp"
    android:paddingRight="20dp" >

    <TextView android:id="@+id/titleTextView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/detailsTextView"
        android:textSize="16sp"/>

    <TextView android:id="@id/detailsTextView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="12sp"/>


</RelativeLayout>

In hopes that I will be able to add a layout that is 100dp in height to my ListView and have two TextViews inside of it. However, when I try to set it up like so:

public View getView(int position, View currentView, ViewGroup parent)
{
    View rowContents = LayoutInflater.from(mContext).inflate(R.layout.list_view_cell, null);
    TextView titleView = (TextView)rowContents.findViewById(R.id.titleTextView);
    titleView.setText(titles[position]);
    TextView detailsView = (TextView)rowContents.findViewById(R.id.detailsTextView);
    detailsView.setText(details[position]);

    return rowContents;
}

It’s giving me a row with only my detailsView TextViewwith a wrap_content height, it seems. The titleView is nowhere to be seen and I would assume the rowContents isn’t being set either, otherwise the height would be 100dp, right?

I know I should be reusing the old view and setting its contents, but I just made this up quickly as a test.

What is going wrong here?

  • 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-17T05:19:24+00:00Added an answer on June 17, 2026 at 5:19 am

    Try setting the lower TextView with layout_below instead:

    <TextView android:id="@+id/titleTextView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="16sp"/>
    
    <TextView android:id="@+id/detailsTextView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/titleTextView"
        android:textSize="12sp"/>
    

    (Otherwise you could “lock” titleTextView into the upper lefthand corner, which might force detailsTextView to move down.)

    But you should watch this Google Talk by one of Android’s lead programmers, it gives great detail on how to make an efficient adapter.

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

Sidebar

Related Questions

Probably I'm just missing something obvious, but I can't get the image in my
This is probably just me being stupid somehow or the other, but I am
Im having a weird issue here. Its probably just something stupid but I dont
I believe what I'm trying to do is simple enough, so I'm probably just
This will probably be just another unsolved thread but i'll fill in some info
OK, I'm probably just having a bad Monday, but I have the following need
I think I'm probably just missing something in the docs here, but how do
I am probably missing something basic here as this just doesn’t seem to be
Probably simple question and I'm just missing something, but I'm stuck out of ideas.
This is probably a simple question that I am just missing but I have

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.