• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps help in approch to Dragging and relocating

joevj

Newbie
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..

Text1
<Text Box 1>

Text2
<Text Box 2>

Text3
<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.

Thanks.

Joe
 
Hi,
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...
 
Back
Top Bottom