1. Are you ready for the Galaxy S20? Here is everything we know so far!

help in approch to Dragging and relocating

Discussion in 'Android Development' started by joevj, Nov 3, 2010.

  1. joevj

    joevj Newbie
    Thread Starter

    Hi everyone,

    I am rather new to Android and I have limited exposure to Java. I have done some sample programs.

    I have three sets of widgets. Each set is with a TextView & a EditText. Now I am populating it using Linear Layout (using xml) and I will see in the following order..

    <Text Box 1>

    <Text Box 2>

    <Text Box 3>

    Now I have to allow the user to reorder this and I would like to provide the drag option. So if I drag down on the first set, then the Text1 and the <Text Box 1> will be draged together to the secod or third position.

    Can someone guide me on the possible approaches. I tried to look at the "Gesters" and I dont know if that the best one.

    If I am not clear in the explanation, please let me know.



    1. Download the Forums for Android™ app!


  2. usml

    usml Newbie

    I haven't done this before, here's what I think it should be (knowledgeable folks please correct me if I'm wrong):
    What user sees it -- when user touches one of the 3 text areas long enough (not sure what's default, 1 or 2 sec), the border of the area (text label and text field) changed to thicker/darker and border rectangle should start to follow user's finger move. When user finally lift finger the widgets move happen.
    What you do in code: check "LongClick" related callbacks in View. I'm not sure how do you draw the rectangle to follow user's finger move, I hope it's something already defined in Android and as easy as making an API call...

Share This Page