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

  • Home
  • SEARCH
  • 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 8065533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:41:44+00:00 2026-06-05T11:41:44+00:00

I got a list from the web (link is here ) where it uses

  • 0

I got a list from the web (link is here )

where it uses two xml layouts to create a list, the first xml is just the background where the second xml is going to be displayed as buttons in a list.

what I am trying to do is have that same list but add a tittle or a picture title at the top, i’ve been playing around with the list but i cant get it to work, the only way i can think to make this happen is somehow moving the position in which the second xml is displayed and have the top part to add whatever i like.

Thank you for the help and ideas to make this work!

[EDIT] code snippet…
First XML layout

<?xml version="1.0" encoding="utf-8"?>
<ListView xmlns:android="schemas.android.com/apk/res/android";
android:id="@android:id/list"
android:layout_width="fill_parent"    
android:layout_weight="1"
android:scrollbars="none"
android:divider="#000000"
android:scrollingCache="true" android:layout_height="wrap_content"/>

Second XML layout

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="schemas.android.com/apk/res/android"
android:orientation="vertical"
android:background="#AA010101"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<ListView android:id="@+id/list"
android:layout_width="1px"
android:layout_height="1px"
android:layout_weight="1">
</ListView>
<RelativeLayout xmlns:android="schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:paddingLeft="10dp"
android:paddingTop="5dp"
android:paddingBottom="5dp" 
android:layout_height="fill_parent">
<ImageView android:id="@+id/img"
android:layout_width="80dp"
android:layout_height="70dp"
android:layout_alignParentLeft="true"
android:scaleType="fitXY" />
<TextView android:layout_width="wrap_content"
android:id="@+id/title" 
android:layout_height="wrap_content"
android:paddingTop="18dp"
android:layout_toRightOf="@+id/img" 
android:textStyle="bold"
android:textColor="#ffffff"
android:layout_marginRight="50dp"
android:paddingLeft="10dp"
android:textSize="16sp" />
</RelativeLayout>
</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-06-05T11:41:46+00:00Added an answer on June 5, 2026 at 11:41 am

    You have to edit the XML file containing the <ListView>, by adding whatever you want before (most probably a TextView with a Compound Drawable). So that what you called the “background” looks more like this:

    Main layout should host a <TextView> (+eventuall a Compound Image) + a <ListView>.

    Secondary layout should host the content of each of your list item. If you have a <ListView> in each XML layout, it means you will have a list of lists… I don’t know much about your list and app, and do not know what information you would like to display in each list item (e.g. ContactName, CalendarDate, Cities… whatever). But there are very few chances that you need a ListView in both of them.

    mainListLayout.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”>
    
        <TextView
            android:id="@+id/Text1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:contentDescription="text to replace image"
            android:drawableLeft="@drawable/reference"
            android:text="Title of the list"/>
    
        <ListView
            android:id=”@android:id/list”
            android:layout_width=”fill_parent”
            android:layout_height=”wrap_content” />
    
    </LinearLayout>
    

    The Drawable can obviously be on the Right, Top or Bottom, and not only on the Left. You might also like to have a look at android:drawablePadding="@dimen/xxx to add some extra space between text/title and the image. Drawable has to be one of your ic_* png files from res/drawable (eventually -hdpi, -mdpi and so on)

    itemLayout.xml

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/relativelayout"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">
    <ImageView
    android:contentDescription="@string/ItemIcon"
    android:layout_width="000"
    android:layout_height="000"
    android:src="@drawable/ic_icone"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"/>
    <TextView
    android:id="@+id/ItemDescription"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:textColor="#000000"
    android:text="ItemDescription" />
    </RelativeLayout>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's what I've got: from sqlalchemy import * from sqlalchemy.orm import * from web.models.card
I've got a class which inherits from a List<MagicBean> . It works well and
I've got WCF service which contains List with data from LibW.dll(my dll). In main
I've got a TabControl which builds a list of TabItems from it's ItemsSource. Like
I've got the following code to output a list of items from amazon, but
I have a list of places in listview which i got from parsing JSON.
I've got two List<Name> s: public class Name { public string NameText {get;set;} public
I have an application that uses images from web a a source. for my
I've got a webmethod in .NET that returns a List of objects. [System.Web.Services.WebMethod(enableSession: true)]
I've got a problem with a web service which has an array or 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.