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.

While there is now RadioButton Preference widget in Android, you can use the existing CheckBoxPreference widget, add the same OnPreferenceClickListener and add a little code to ensure that only one CheckBox gets clicked.

To start with, here is a sample of a preference XML file.

And in the onCreate() method, you can do it like this:

That should do it.

When Android Lollipop was released, I was excited. Who wouldn’t? Every new version always comes packed with new features and enhancements.

Sad to say when I upgraded to Lollipop it gave my app problems instead. Two things my app used, an XML drawable that displays a radial gradient effect and an animated inside an AsyncTask class that uses Thread.sleep in between.

So first, the radial drawable.

I had a custom color and named it theme_green. It worked okay in previous versions but in Lollipop 5.0, the radial effect does not work anymore, and so does the color. It seems like only the startColor is used hence the different color result.

The other issue I had was the Thread.sleep inside the doInBackground() where I had a for loop that shows an animated and used the Thread.sleep to simulate a pause in between animation.

The result was that the animated got slow. I had to switch to using a TimerTask instead to preserve the smoothness of the animated that was working prior to Lollipop 5.0.

Oh, and even SystemClock.sleep() inside doInBackground() did not work either.

So there. Just to give you a heads up that you might think it is the Lollipop 5.0 operating system that is the issue. They definitely changed some things that affected how the Thread.sleep() works inside the doInBackground() method of an AsyncTask class.

Related Posts Plugin for WordPress, Blogger...