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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:19:12+00:00 2026-06-18T10:19:12+00:00

How can I make the first visible element of the ListView having a different

  • 0

How can I make the first visible element of the ListView having a different layout from the others.

the first cell have a description

when is list is scrolled and 2nd cell is at first position the description of the 2nd cell is shown

I have created a custom adapter with 2 different layouts. Now, how can I make the layout change when the item comes in the first position?

  • 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-18T10:19:14+00:00Added an answer on June 18, 2026 at 10:19 am

    to get the the first item of the listview having a different layout the following code can be used. But the listview don’t move when the items in the list are less than the no of visible items.

    list.setOnScrollListener(new OnScrollListener() {
    
            @Override
            public void onScrollStateChanged(AbsListView view, int scrollState) {
                // TODO Auto-generated method stub
    
            }
    
            @Override
            public void onScroll(AbsListView view, int firstVisibleItem,
                    int visibleItemCount, int totalItemCount) {
                // TODO Auto-generated method stub
    
                if(firstItem != firstVisibleItem)
                {
                    firstItem = firstVisibleItem;
                    adapter.notifyDataSetChanged();
                }
            }
        });
    

    and inside the adapter class check if the postion is same as firstItem if its equal then show the detals layout.

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

Sidebar

Related Questions

I have two cmake-related problems: first, I can't make it to find the includes
How can I make an app play a video walkthrough (only) the first time
I can not locate the correct method to make the first item in a
How can I make this second struct work, when the first struct has a
I can make a variable's name from two variables' value: $a = 'tea'; $b
I wonder how can I make a ListView 's elements slide out on slide
For ASP.Net, I know I can make a lot of different HTML elements runat=server
I have a page with a table that can have different number of columns.
How can I find the first element in a document which has style=display:none; set
I have created a custom content type and using views2 for creating various page-views.

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.