It seems that whenever I set an ActionView of an ActionBar MenuItem, its alignment moves to the left. Worse, there was a case wherein the 3 dotted icon also moved to the right.

When I decided to use an animation in the refresh icon, only this one moved. The 3 dotted icon stayed put. Good, right?

At least I only had one problem left to solve. So my ActionView XML Layout looks like this:

This should work. Adding a padding to both the left and right should make the ActionView drawable stay put.

Also worth noting is that even if you use the Toolbar class, the same thing happens when you set the animating ActionView. This layout with the correct padding values should fix that.

Here is an effective class I use to detect gestures in Android devices such as flinging in any direction whether it is up, down, left or right using a GestureDetector.

I found this class in the illusionsandroid website and modified it a little to suit my requirements such as changing the value to at least detect a bit of a long fling rather than a short one.

To use the class. do it like this.

And, in your onTouch() method as I am sure your Activity implements the OnTouchListener, use the flingListener like this:

Here is an XML file for a slide to left animation transition in Android.

Related Posts Plugin for WordPress, Blogger...