Android image drag and move from one layout to another
Is it possible to move a ImageView from one layout to another. If i move an image from one layout to another i get an exception "java.lang.IllegalArgumentException: Given view not a child of xyz layout"
If i long press on a application icon, the a开发者_如何学运维pp is moved from app list view to workspace. How does the launcher do this. How is it able to move the app icon from one layout to another layout ?
I would think of it differently. Instead of moving the actual view object, your layouts should be able to create and remove the same type of view based on the data that the view represents. It sounds like you're doing a regular drag/drop from one layout to another. When the drop occurs in the new layout, this layout should be aware of the data that is dropped and be able to create a new view based on this data. The original layout should be aware that it has lost this data, and remove the original view. Thinking in terms of the data that the view represents instead of the view object itself is probably the way to go here.
精彩评论