Is there anyway to control the visibility of drag shadow in Android? - android

Currently I'm working with tablet Android development. I want to drag a view from fragment A to fragment B, but the dragshadow will move from the destination to original position for the first time. Is there anyway to control the visibility of drag shadow in runtime?

You can disable drag shadow using following property in your View Pager.
android:overScrollMode="never"

Related

how to drag two view simultaneously

I just want to know how to drag two views at the same time
first view is its original image view
Second one is its shadow
I am using dragShadow builder to build a drag shadow but when I drag a view using touchlistner it is only drag shadow of my main view and the main view is stick on their position ..
so my question is Is there any solution to enable drag both view simultaneously?
thank you for any kind of suggestion..
attach a picture
Wrap both ImageView and shadow in ViewGroup, for example, FrameLayout, and drag FrameLayout instead of ImageView.

Drag and Drop view outside of Recyclerview

What I want to achieve: I want to have a view inside a scrollable layout (Recyclerview with GridlayoutManager) with tiles (Views) in it. Dragging and dropping an item inside of the RecyclerView should adjust the position of the icon and swap with the other elements. When a drag starts, an icon above the RecyclerView will change to a trash icon and dragging the view to this icon will delete it from this RecyclerView.
I tried this excellent tutorial, but I didn't find a way how to handle dragging outside of the Recyclerview as the ItemTouchHelper.Callback uses only Recycler.ViewHolder elements as possible targets.
The method interpolateOutOfBoundsScroll() gives feedback if the view moves out of the boundaries, but will only give back the total size that is offscreen, but no coordinates. Also, trying to drag the view out of the Recyclerview always results in cutting of the View where it passes the borders of the Recyclerview.
Does anyone have an idea how I could achieve this effect?
You can achieve this simply by set this attribute for the parent of the RecyclerView:
android:clipChildren="false"
Edit: thank Adam Katz, I don't know why but sometimes you have to add this to the RecyclerView to make it work:
android:clipToPadding="false"
You are bound by the RecyclerView boundries. You have several options:
Make the RecyclerView's layout height to match_parent and to be on top of your upper view (is it a Toolbar?) and add a sticky header of the same size and have an empty transparent layout. That way you could drag ther and see the item floating over there.
Instead of dragging an item to a garbage can icon which is located too close to a legitemate upper-right item, make a long click to select the item (and apply a signal like a check mark or a red mask) and make the garbage can appear and delete uppon click (and maybe allow multi item deleting)

Animate part of Activity Launch

Is it possible to animate part of an activity launch?
I am not wanting my action bar to animate, however the rest of the view should slide in.
I have tried using a Gallery for this, however I have not been able to animate the gallery while programatically setting the selected view. This is because the gallery does not load more than the currently displayed view and its immediate adjacent views.
When you can use the viewflipper for this. Which shows 1 child at a time. You can set a IN and OUT animation for the views. So when you set the activew view index animations will be applied.

How to draw custom animation as Activity background

I have a standard Activity with its layout, and I have a custom animated View.
I want this View to permorm a fancy "intro" animation, after which the standard Activity is displayed with the animated View as a background.
The application should be compatible with froyo (2.2) devices.
You can use a frame layout and insert two views, one is your custom view animation and the second one which will come on top would be your normal layout.

Struggling with view animations

I've got an absolute layout. In that layout is a custom view that takes up the left 3rd of the screen. I put a button in the layout that I want to cause the custom view to slide on and off of the screen. I've tried using animation resources (translates... "slidein" and "slideout") and the function startAnimation on the custom view, but I can't get the behavior I am looking for.
OK... I start with the custom view visible and in onCreate I find the view and animate it off screen using my slideout animation. That works fine. I figured out that I need to set "fillAfter" in the animation so that the custom view stays off screen.
Now, when I press my button I want to cause the custom view to slide back on the screen, so I trigger my slidein animation using startAnimation again but with slidein. BUT... that causes the view to first jump back to its original position AND THEN slide to the right... causing it to finish in the middle of the screen.
How do I get the animation to use the view's current position as the animation starting position, not its original position?
Thanks
I also experienced the flicker described in this question. My solution was to use the improved Honeycomb animation APIs. There is a convenient library that ports these all the way back to Android 1.0:
http://nineoldandroids.com/
For more on Honeycomb Animation APIs see:
http://android-developers.blogspot.com/2011/02/animation-in-honeycomb.html
In my case I had 2 overlapped LinearLayouts inside a RelativeLayout. I wanted to slide the top LinearLayout off the screen and reveal the bottom LinearLayout below. Then I wanted to slide to top LinearLayout back on screen to its original position so the top layout covered the bottom layout again. Using the old animation APIs I was seeing a flicker before the second animation (offscreen -> onscreen) was starting.
With the new APIs this task turned out to be trivial:
// Slide out (add to button handler)
ObjectAnimator.ofFloat(mTopLayout, "translationY", mTopLayout.getHeight()).start();
// Slide back in (add to button handler)
ObjectAnimator.ofFloat(mTopLayout, "translationY", 0).start();
The Honeycomb Animation APIs actually move objects around on the screen (rather than pretending to move them like the older animation APIs), so there is no need to fool around with filleAfter, fillBefore, etc.
Look into setting the fillAfter property to keep the end animation state

Categories

Resources