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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:46:30+00:00 2026-06-10T03:46:30+00:00

Is it possible to create a list view in android that is not fixed

  • 0

Is it possible to create a list view in android that is not fixed to a particular position and user can move the list view on a gesture some what floating listview that can be moved anywhere on the screen?I tried finding it but could not find some link.Does any one have some idea about it?

  • 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-10T03:46:31+00:00Added an answer on June 10, 2026 at 3:46 am

    You can achieve this by setting an OnTouchListener on the list view and overriding it’s onTouch() method. In the onTouch() method you will have to handle the touch events like(ACTION_DOWN, ACTION_MOVE). Here is how you can handle touch event:

    @Override
    public boolean onTouch (View v, MotionEvent event)
    {
        switch(event.getAction() & MotionEvent.ACTION_MASK)
        {
            case MotionEvent.ACTION_DOWN:
                start.set(event.getX(), event.getY());     //saving the initial x and y position
                mode = DRAG;
                break;
            case MotionEvent.ACTION_MOVE:
                if(mode == DRAG) {
                    float scrollByX = event.getX() - start.x;    //computing the scroll in X
                    float scrollByY = event.getY() - start.y;    //computing the scroll in Y
                    v.scrollBy((int)scrollByX/20, 0);            
                }
                break;
        }   
        return false;
    }
    

    When the user places the finger down on the screen the ACTION_DOWN event is triggered and when the user drags his finger on the screen ACTION_MOVE event is triggered. Hence a drag event is a combination of ACTION_DOWN and ACTION_MOVE.
    Once you have the scrollX and scrollY value the you can move the view on the screen by passing these values to the scrollBy() method of the View class.

    Here in the code there are two things to notice:

    • first is that I have passed 0 as the value of scrollY as it will prevent the list view to be dragged and scrolled simultaneously.
    • second is that the return value is false as you want the android to handle the scrolling of the list items

    Here you can find the complete code for this

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

Sidebar

Related Questions

I was trying to create a simple list view that has some padding for
If it is not possible to create this list without loops, I'd be content
Is it possible to create a multidimensional list in C#? I can create an
Possible Duplicate: How to list my app downloads I created an android app that
I need to create a more advanced list in my android application, that will
I would know if it is possible to create a ListView with a fixed
Is it possible to create a new List<T> where the T is dynamically set
Just wondering if it is possible to dynamically create a list of strings in
Possible Duplicate: How to create comma separated list from array in PHP? My array
Is it possible to automatically create Word documents which include list fields from a

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.