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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:14:35+00:00 2026-05-31T18:14:35+00:00

In my application i am inflating a web view into a list view and

  • 0

In my application i am inflating a web view into a list view and have set long press click event to the web view. On long press i am duplicating a item to appear on the list view. as shown in the image.

I want to know the clicked item position so that i can make the duplicate view appear exactly above the clicked item, but now it appears on the first item in the list.

the item in grey is the duplicated item, i have clicked on the 10th item and it appears on the 1st item. how would i make it appear on the 10th item
![enter image description here][1]

wv.setOnLongClickListener(new OnLongClickListener() {

            @Override
            public boolean onLongClick(View v) {
                duplicateView.setVisibility(View.VISIBLE);
                Log.d("lvsectionTwo "+lvsectionTwo.getScrollY(),"log");
                WebView wv = (WebView) duplicateView.findViewById(R.id.wv1);
                wv.loadData("item "+position, "text/html", null);
                wv.setBackgroundColor(Color.DKGRAY);

                ![enter image description here][2]



                return true;
            }
        });
        return view;
    }
  • 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-05-31T18:14:36+00:00Added an answer on May 31, 2026 at 6:14 pm

    Get the y position of view by:
    http://developer.android.com/reference/android/view/View.html#getLocationInWindow%28int%5B%5D%29

    it would require an array of integer of length 2
    and x, and y co-ordinates would be stored in that array object, now use that object to get Position of view

    private OnItemLongClickListener onlongpressed = new OnItemLongClickListener() {

                @Override
                public boolean onItemLongClick(AdapterView<?> arg0, View view,
                                int position, long id) {
                        duplicateView = ((LayoutInflater) getBaseContext().getSystemService(
                                        LAYOUT_INFLATER_SERVICE)).inflate(R.layout.dragview, null);
                        frlayout.addView(duplicateView);
                        int[] dimensions=new int[2];
                        getLocationInWindow (dimensions);
                        FrameLayout.LayoutParams layoutParams = frlayout.getLayoutParams();
                        layoutParams.setMargins(0, dimensions[1]-20, 0, 0);
                        duplicateView.setLayoutParams(layoutParams);
                        duplicateView.setVisibility(View.VISIBLE);
                        WebView wv = (WebView) duplicateView.findViewById(R.id.wv1);
                        wv.setBackgroundColor(Color.DKGRAY);
                        wv.loadData("Item "+position, "text/html", null);
                        return true;
                }
        };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a web application running in a production enviroment and at some point
I have a fairly conventional Grails application. It's monolithic; although it's somewhat split into
Application[temp] = 8; should set the value 8 to the key temp . However,
Application launch through Java web start(JWS) checks for update when we are launching it.
Our application takes text from a web form and sends it via email to
i am new to android. in my application i have a button .i put
We have been doing some research into physically isolating the secure and non-secure sections
We have a suspect application leaving a connection open. Just wondering on the debugging
I'm building an application which relies on the Google Maps API, but running into
I have a problem with a custom LinearLayout I'm creating for an application. Basically,

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.