I would like to know whether it is possible to change the z-order of a shared element transition? Look:
I have a layout with an image, that fills the whole screen. In front of the image is a textbox which shows the title of the image. If I klick on the textbox, the transition to the detail activity starts. Therefore I implemented a shared element transition, in which the fullscreen image animates to a smaller version of itself in the detail view. The picture below illustrates this behaviour.
My problem now is that in both activities are textboxes, that are placed above the shared element image. And if I went from overview to detail activity, I see the circle textbox with the number only after the shared element transition is finished.
I would like to place the textbox with the number above the shared element transition, so that I could do an animation on this view element, too.
any idea on how to solve this?
If I'm not mistaken, android calculates which views are on top of others by using the elevation of the views. Try playing around with the elevations (or the translationZ values) to decide which view(s) should be on top.
Solution : ViewGroupTree
Solution
level 0 : MainConstraint //(your row)
level 1 : ImageView / Otherlayout
level 2 : TextView
item A::BackgroundImage : MainConstraint -> ImageView
item B::BackgroundTextView : MainConstraint -> Constraint -> TextView
With this, the layout are Z index order are messed up.
because ImageView and TextView have different layout hierarchy, add your ImageView inside an other layout and it's will work as expected !!
You have to use the same level of deep for each of your view to get a, expected call
I hope it's not late ;)
Related
I'm trying to do a shared element transition with a TextView between an item in a list, and it's detail view.
The transition itself is working correctly, the text and images are moving both to the details fragment, and back to the list to the correct locations.
The problem I'm having is the TextView on the list has left gravity, and the TextView on the detail has center gravity. When the transition happens, it's keeping the left gravity of the original TextView.
It's only after I call requestLayout() in code or click on an actionable item on the screen, that the text centers itself which won't work. I've tried this with and without the onPreDrawListener where you use startPostponedEnterTransition and it's the same problem.
Is there something I need to specifically do so the transition goes to the correct centered location on the detail view immediately?
I don't quite have time to make a sample app of this happening, but I'll have time next week if it's needed. I'm hoping there's just some weird flag that I don't know about and can't find that would resolve this.
First of all, I search on forum title about sliding page and I am not using fragment view. I have one xml layout and one java document.
Xml includes one textview and one imageview also one prev and one next button.
In java file, I have and array and it includes letters: a,b,c...
My problem is that when I clicked next button, my textview and imageview will changed with sliding animation. How can I do it?
Thanks.
Maybe my answer to: How to animate a slide in notification view that pushes the content view down can be of help.
It slides a View nicely into the screen while pushing the other layout down.
Think same process could be applied to what you want.
I have two image views in a table layout (two cells). Only one of the image views has an image displayed (the other is blank).
When a user taps on the view with the image, I would like the image to transition into the empty view.
Does anyone know how I can achieve this?
You could do it with a TranslateAnimation. If I were doing it, I would set the first one(which starts with the pic in it) to View.GONE, set the other to VISIBLE, then apply a translate animation to the second one that will slide it from the position of the first to where it is supposed to be.
This page has a nice tutorial on how to use various types of animations.
I build a Listview, each item of this Listview in a layout composed of a Gallery.
On click of an item of the Gallery, I want to translate it to the top of my screen.
Even with setZAdjustment(Animation.ZORDER_TOP); my gallery cell doesn't move outside the gallery.
I assume it's because it can't go outside it's parent view.
Is there a way to do this ?
Thanks
I assume it's because it can't go outside it's parent view.
you are right.
There is no way that you can move that exact view. What you can do is make yourself a new ImageView and add it to your top level layout right over the top of the selected cell. Set its image by calling .getDrawingCache() on the gallery cell. Then you can animate your new ImageView to where ever you want.
Depending on what you want to do with it once it has been moved this might work out for you. But fair warning it is a somewhat convoluted process to achieve the effect you're after
I have a ListView and each item contains a TextView displaying a number. I'd like to give my users the ability to change this number while staying on the ListView (as opposed to drilling down into a detailed view by clicking on the list item).
What I'm looking to do is to slide in a layout from the bottom of the screen that covers about half of the screen. I'd like this layout to be OVER the Activity behind it (as opposed to being part of that Activity's layout and simply showing it). I'd also like it to be model (or seem modal). Meaning the Activity behind it can not be focused and manipulated. In this layout I will essentially create a calculator.
What I need help with right now is:
1) How to display a layout over the current Activity
2) How make the background (the Activity) modal
Could someone point me to some tutorials/resources and/or give me a few tips?
use an Animation. here is a small tutorial on them: http://developerlife.com/tutorials/?p=343
initially, the view you want to be modal must be placed where you want it to show up(and visibility set to gone).
use a translate animation to visually move the view from below the screen to halfway up the screen. once the animation starts, set visibility to visible
try disabling all views that the user should not be able to interact with after you have started the animation holding the calculator view