Reputation: 12664
I want to set background image with rotation and repeating the background image.
For repeating
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/border"
android:tileMode="repeat" />
For rotation
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="90"
android:toDegrees="90"
android:pivotX="50%"
android:pivotY="50%"
android:drawable="@drawable/border">
Now I want to combine this code in one drawable and want to use as background
I'm trying like this but not working
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:tileMode="repeat" >
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="90"
android:toDegrees="90"
android:pivotX="50%"
android:pivotY="50%"
android:drawable="@drawable/border">
</rotate>
</bitmap>
Upvotes: 1
Views: 1103
Reputation: 5470
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="-45"
android:pivotX="50%"
android:pivotY="50%">
<bitmap
android:alpha=".5"
android:src="@drawable/image"
android:tileMode="repeat" />
</rotate>
Upvotes: 1
Reputation: 5263
I would suggest you to use a custom view. I also tried that for my animated background. Just use thread, handler and canvas.scale() method for rotating the view background. And one thing i wanna ask. Whats the need of setting as background? You can set the rotating drawable as a background view and do the other things on the view above with transparent background.
Upvotes: 1