DrawerLayout set drag area vertically - android

I am using DrawerLayout and I have reduced the dragging area horizontally via reflection as someone suggested. It's a hack, I know, but it works.
Is there a way to reduce the dragging area vertically ? Say only top half of or bottom half of the screen allowed to drag ?

Related

How to put the right border of a View onto horizontal center?

In my Android app, I am using a RelativeLayout to custom one of my Activitys.
I have a square ImageView that I want to set precisely. In other words, I want its right border to touch the horizontal center of the layout.
Is such a thing possible without doing weird things such as centering and then marging?
It's not a perfect solution but potentially you could use:
android:layout_marginRight="xdp"
Where x is half of your screen width + half the width of your imageView?
I know it's not perfect but might help until some guru comes along

Move an element in relative layout to absolute edge of the screen

Is it possible to move a button or any other element in relative layout to the absolute edge of the sreen? If I drag a certain element to the edge of the layout, eclipse will automatically place it a few dp away from the edge. It'll basically just create a small space between a button and the end of the creen. Is it possible to bypass that?
I know buttons aren't meant to be that close to the edge of the screen anyway, but I need it for a certain thing.
The normal button has a little padding by default, because the buttons backgroundimage is a 9-patch image with padding left, right and on bottom. That's why you see the space between button and screen.
To solve this you can use a custom button. For example change the backgroundimage of button like this android:background="#drawable/image".

Android: Drag View outside screen

I have an activity where users can drag and drop around some buttons.
All my draggable views are inside a RelativeLayout and to drag them around I change their top and left margins.
Everything works perfect, except that when I drag the views close to the right and bottom edge of the screen, they shrink instead of being drawn outside the screen.
Is there any way for having the same behaviour on the all edges of the screen (currently only works fine on the top and left edge).
I guess I can have a left and top negative margin. But when I have left margin > screen width or top margin > screen height the images shrink.
To implement custom positioning of views inside a ViewGroup the best way is to implement your custom ViewGroup overriding onLayout().
It is not that difficult and I explained how to do it here. (the question is newer and has more visibility)
Edit:
You might also want to look into the Drag and Drop Api here. Thanks to Zainodis for the comment.

resizing images, flipping immages using animation in android

I am working on some animation in which there are four images. I want to do as follows:
Flip them from right to center
Then from center to left side
The right side should be smaller and when flipped, it should come to center and size of the image should be enlarged.
The next image should come to the center and the current image should go to left side and the size of the image should decrease by animation(or scaled).
Basically I want images to grow from right to center and then shrink to left side...same thing for left to right.
Can anybody please tell how to do this animation?
Thanks
Perhaps android-3d-flip-view-transition is what you are looking for? There is also the FlipAnimator class, it really depends on how you want to implement this but from what I can tell they both allow you to specify pivotal points so you can flip left-to-right like a book or centered like in iOS when you click the little "i" info button at the bottom-right hand corner of some apps.

Android slide animation problem

I have a 3 horizontal views - an image on the left which is a thin vertical handle-type bar and an image to its right followed by a textview. What I'm trying to achieve is a sliding animation, activated with a click on the handle, so that the center image slides in and out to the left (and so disappearing when fully left) with the textview following this animation smoothly. The effect will be the handle remains in place (hence I can't use the SlidingDrawer), the image comes and goes and the textview is always present but slides into the space where the image went. Its just collapsing the image really.
The problem is if I apply android.R.anim.slide_in_left/android.R.anim.slide_out_left to the image and the textview simultaneously I see they slide completely to the left edge of the screen, temporarily overwriting the handle. Is there a way to still animate but not go all the way to the screen edge?

Categories

Resources