Here is how to make view infinetely rotate around its center: 1. Define animation in xml Put this file in /res/anim: <?xml version="1.0" encoding="utf-8"?> <rotate xmlns:android="http://schemas.android.com/apk/res/android" android:duration="2500" android:interpolator="@android:anim/linear_interpolator" android:pivotX="50%" android:pivotY="50%" android:repeatCount="infinite" android:repeatMode="restart" android:toDegrees="360" > </rotate> 2. Load animation in java file I load it in onCreate and keep it as a class field. Thanks to … Continue reading Android rotate animation
Tag: rotate
Android triangle (arrow) defined as an XML shape
Arrow icons are widely used in android applications. Some use cases are pagination, incrementing or decrementing numeric values or on next / previous buttons. The example of such arrow that I needed was gray triangle arrow like this one I decided to build such reusable arrow as an xml drawable, so that there is no … Continue reading Android triangle (arrow) defined as an XML shape
Android: button with rotated (vertical) text
If you want to build button with vertical text like that: You can override standard button and its onDraw() method. There you have to rotate text before drawing it. Same thing can be done with TextView - since button actually is extended TextView. 1. Write your own Button implementation Here is code that actually you can … Continue reading Android: button with rotated (vertical) text