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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:00:22+00:00 2026-06-05T02:00:22+00:00

I made a nice android header. The only problem with it is that whenever

  • 0

I made a nice android header. The only problem with it is that whenever the user scrolls down, the header follows the scroll. So the header ends up scrolling and remains on the screen.

What I want to happen is for it to stay glued to the very top of the page. Is that possible?

Here is my header:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" 
android:layout_height="fill_parent"
 android:orientation="horizontal"
>

    <!--     android:textColor="@color/white"
    -->

 <Button android:id="@+id/home_header"
  android:layout_width="0dp" 
  android:layout_height="wrap_content"
  android:layout_weight="1"
  android:textColor="@color/white"
  android:text="Home"
  android:background="@drawable/ic_menu"
  android:textSize="11dp"
/>

<Button android:id="@+id/businesses_header"
  android:layout_width="0dp" 
  android:layout_height="wrap_content"
  android:layout_weight="1"
  android:textSize="11dp"
  android:text="Businesses"
  android:textColor="@color/white"
    android:background="@drawable/ic_menu"
  android:layout_toRightOf="@+id/home_header"
 />   

 <Button android:id="@+id/learn_header"
  android:layout_width="0dp" 
  android:layout_height="wrap_content"
  android:layout_weight="1"
  android:text="Learn"
  android:textColor="@color/white"
  android:textSize="11dp"
  android:background="@drawable/ic_menu"
  android:layout_toRightOf="@+id/businesses_header"
 />   


<Button android:id="@+id/questions_header"
 android:layout_width="0dp" 
 android:layout_height="wrap_content"
 android:textColor="@color/white"
 android:layout_weight="1"
 android:text="Questions"
 android:textSize="11dp"
   android:background="@drawable/ic_menu"
android:layout_toRightOf="@+id/learn_header"  />  



 <Button android:id="@+id/extra_help_header"
  android:layout_width="0dp" 
  android:layout_height="wrap_content"
  android:layout_weight="1"
  android:textColor="@color/white"
  android:text="Premium"
  android:textSize="11dp"
  android:background="@drawable/ic_menu"
  android:layout_toRightOf="@+id/questions_header"
 />   
</LinearLayout>

Thank you

  • 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-05T02:00:24+00:00Added an answer on June 5, 2026 at 2:00 am

    The first thing you should do is change the height in your header to wrap_content:

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content"
        android:orientation="horizontal">
    

    Then save the header layout in its own layout file (header.xml). Then use include statements whenever you want to use your header.

    Here the header stays on top:

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical">
    
        <include android:id="+@id/header" layout="@layout/header" />
    
        <ScrollView
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">
    
            <LinearLayout
                android:id="+@id/content"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">
                <!-- put content here -->
            </LinearLayout>
        </ScrollView>
    </LinearLayout>
    

    Here it scrolls with the content:

    <?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="fill_parent">
        <ScrollView
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">
            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:orientation="vertical">
    
                <include android:id="+@id/header" layout="@layout/header" />
    
                <!-- put content here -->
            </LinearLayout>
        </ScrollView>
    </RelativeLayout>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've made this nice python app that runs when i use python main.py in
So, I have this nice little view that I've made, which basically shows two
I have this nice android app made up and was going to add in
My initial look at Jersey suggested this was a nice framework that made it
I made a nice menu, and I also wrote a new design for only
I made a simple web service which worked nice with few systems that it
I have made a UITabelView that works nice, but when i now press a
Made this nice little loop for hiding and showing div's, works as a charm
how can i made some nice slideshow for the index.html page, with lets say
On Diveboard, we made a nice hack of photoswipe to support videos Everything went

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.