How to move objects across layouts using Drag and Drop - android

I can move objects in their parent layout but I could not find how to move them to another layout. Does anyone know it?
Edit: This tutorial shows how to do. fupeg.blogspot.com/2011/03/honeycomb-drag-and-drop-basics.html

This is a buit-in functionnality coming with Android honeycomb, see this specific article.
If you want to do that on earlier versions, try that tutorial.

Related

sliding layout like google maps v7

Im trying to get the same result as new google maps, when you "tap" on any "marker" you get a little layout in bottom of the screen, all the info about the srteet view and other details shown there, when you hold and move your finger to top of the screen the layout moves and c over all screen or half of the screen. i was thinking use slidingDrawer but seems google depreceate this method on api 17. so how i can achieve this?
Im attaching the image of example:
you could look into using this SlidingUpPanel which appears to be exactly what you are looking for
Now from with Android Support Library 23.2 we can use Design Support Library: Bottom Sheets
Something that might be worth looking into is the answer to this question.
More specifically the answer that links here.
Basically the idea is that They realized that the sliding drawer left some things to be desired and they created a custom component with similar functionality. This will give you more freedom and a way around using deprecated classes. Let me know in comments if there's anything else that would be helpful to know.
Happy coding!

How to handle views on top of the FlipView?

I'm using this library that allows flipping between views like the "FlipBoard" app.
It works quite well.
The problem is that I need to put a few views on top of it, so I've put it inside a FrameLayout, and the rest of the views after it.
It looks ok, but it has a problem:
When flipping, the views that are on top of it change their transparency (and even become hidden) till the flip is over.
How can I handle this problem?
EDIT: I've found this library which doesn't have this problem, but it has a weird color transition while flipping that I wish to avoid.
EDIT: I've found out that this is a known issue (#49) . Would love to know if anyone else has an idea of how to overcome this.
I don't know how to fix this library, but it seems this library works fine :
https://github.com/emilsjolander/android-FlipView
Not sure though how customizable it is compared to the one i've tested.

Drag and drop items around GridLayout - Android

I have a GridLayout with some items in it. Nothing special on it.
I just would like to know if I can drag items around and make the other items automatically arrange themselves.
It's like Android does in Jellybean if you move an icon near another icon.
Is that possible in GridLayout?
Thank you!
I don't know if that is possible with a GridLayout, doubt it, but here is a example that looks like a GridLayout and implements Drag and Drop. This should solve your issue.
I feel like there are many projects which could solve this slightly better than the other answer:
See the following question
Within this, the following projects are mentioned:
PagedDragDropGrid
Alternative View Drag and Drop
Google Project and some other 3rd party stuff
This may help you find some stuff other than GridViews as well.

Dragging and Dropping a button from one Linear Layout to another Linear Layout

I have a linear linear layout with 10 buttons in it. I need to drag these buttons and add it into another linear layout(Horizontal) in the order they are dropped. Please help me in doing this?
I have some suggestions on how to do drag-drop in apps running on API level 8 up and beyond. I studied the source code for the Android Launcher module and learned about the drag-drop framework they put in place for that. I have found that is a good foundation on which to build. I have written up the details of the key classes (DragSource, DropTarget, DragLayer, DragController) in a series of articles on my blog. A solution is too long to post here, so I refer you to those notes:
(a) Moving Views In Android - Part 2, Drag and Drop - this describes the basic framework and includes a demo app. Since I was primarily concerned with learning about drag-drop, I used the now deprecated AbsoluteLayout class. The follow-on to this one (Part 3) is worth looking at too because it develops further the notion of DropTarget.
(b) Drag-Drop for an Android GridView - a demo app that shows how to use the drag-drop framework for grid views. Even better, it illustrates how to get by without AbsoluteLayout. In this case, the DragLayer and other classes know more about the kind of layouts they are working with.
The demo apps illustrate images and text views being dragged. The underlying code is perfectly general: any view can be dragged. A problem you will face with dragging buttons is making sure that the start of a drag operation will not be confused with the normal click handling that buttons do. Consider using a long click to initiate a drag sequence.

Possible to rename widget after laid out in RelativeLayout?

Working with Android for the first time, I've blocked out a layout using the relative layout and laid down some buttons and text widgets how I like them. However when I go back to rename the IDs the layout goes all crazy moving elements around and in general destroying the hours of work I spent laying them out.
Does anyone know how I can rename the widgets without Android destroying the positioning for widgets in the Relative Layout? Is this some "feature" of Android? I can't imagine why it would be hard for the UI builder to handle simple renaming of a widget ID without destroying the positioning information.. Do I have to use an external text editor and modify the XML files directly? Ughh I hope not.. I'm using Eclipse IDE.
You can use find and then replace all to change the names every place that they appear. Shouldn't take anywhere near an hour if you're dealing with a small layout.
In general the graphical UI creator that is currently included with the Android SDK is not so great for creating anything but very simple layouts. In my experiences (which were a long time ago, it may have gotten better since) it was terrible with RelativeLayouts.
If you have not modified your xml directly then it is time that you jump in and start learning to do it that way. You'll find that you have a much greater level of control over your layout, and once you get the basics figured out you'll probably be able to create quicker using raw xml then with the graphical tool anyway. I do wish that there were a nice GUI creator for android out there, the best one that I've ever come across is Droid Draw which I found to be better than the one included with the SDK, but still not as good as I was hoping.
To modify the xml directly you don't need any additional text editors, you do it inside eclipse. Open up your layout file and at the bottom click on the tab that says "Source" when you want to switch back to graphical (good to see the changes that you make to the xml graphically) just click back to the tab that says "Design"

Categories

Resources