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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:43:40+00:00 2026-06-17T18:43:40+00:00

i have a xml file contains some UI elements and a listview, above the

  • 0

i have a xml file contains some UI elements and a listview, above the listview there is relativelayout , i want when scrolling the listview , the relativelayout scrolls with it, how?

  • 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-17T18:43:42+00:00Added an answer on June 17, 2026 at 6:43 pm

    You can use ListView.addHeaderView(View view).

    Note that in this case you should exclude your RelativeLayout from xml and create it in runtime. Also addHeaderView MUST be called before setAdapter.

    UPDATE

    just extract RelativeLayout to a separate xml file (e.g. header.xml).

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >
    
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/orderMeal"
            android:layout_marginLeft="20dip"
            android:id="@+id/tv_restaurant_description_orderMeal"
            android:drawableTop="@drawable/order_meal" />
        <TextView 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/favorite"
            android:layout_alignParentRight="true"
            android:layout_marginRight="20dip"
    
            android:drawableTop="@drawable/favorite"/>
    </RelativeLayout>
    

    and then inflate it in the code:

    lv_restaurantInformation = (ListView) findViewById(R.id.lv_restaurant_description_information);
    lv_restaurantInformation.addHeaderView(LayoutInflater.from(this).inflate(R.layout.header, null));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a custom xml file that contains some elements that make up
I have an XML Template file. This file contains a header and some predefined
I have a XML-file, which contains the data of a calendar. I want to
I have an XML file which contains some Anchor(A HREFs) tags in the XML
I have an XML file which contains text with some very simple layout constructs:
I have a huge xml file (1 Gig). I want to move some of
i have an xml file that contains lots of different nodes. some in particularly
I have a XML file containing some elements like <root> <gp> <i>1</i> <i>3</i> <i>5</i>
I have an xml file with a node that contains some c# code. <Script
I have an xml file that contains its element like <ab:test>Str</ab:test> When I am

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.