The methods applied in the previous recipe, although simple to apply, are restricted. Ideally we would like to take control of a bitmap directly so that we can impose more sophisticated transformations.
In this recipe we will create a bitmap with a BitmapFactory and rotate it with a Matrix. Both these objects belong to the android.graphics package.
This recipe is quite similar to the preceding one. If you wish, you can edit it to match what you find here or simply start a new project in eclipse. Either way we will need an image file stored in any of the res/drawable
folders called my_image.png
.
We do not need the TextView included by the wizard, so remove this and provide the layout in
main.xml
with the single ImageView as follows:<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android...