The answer is to also make fromDegrees=45. I thought from/toDegrees referred
to point 0 and point n of the line, but it refers to animation. The rotate
XML node is an animation. So you're telling it to move it from 45 degrees to 45
degrees (there's no other way to rotate a line in XML layout). Just set the
duration of the animation to 0.
From: don rhummy donrhu...@yahoo.com
To: Android Developers android-developers@googlegroups.com
Sent: Tuesday, March 5, 2013 8:56 PM
Subject: [android-developers] How rotate a line in Android XML?
I'm trying to draw a diagonal line in an Android app with the XML, but it is
not working. It simply draws a horizontal line.
main.xml
RelativeLayoutxmlns:android=http://schemas.android.com/apk/res/androidxmlns:tools=http://schemas.android.com/toolsandroid:layout_width=match_parentandroid:layout_height=match_parentandroid:paddingBottom=@dimen/activity_vertical_marginandroid:paddingLeft=@dimen/activity_horizontal_marginandroid:paddingRight=@dimen/activity_horizontal_marginandroid:paddingTop=@dimen/activity_vertical_margintools:context=.TestActivity;RelativeLayoutandroid:layout_width=match_parentandroid:layout_height=match_parentandroid:layout_alignParentLeft=trueandroid:layout_alignParentTop=truestyle=@style/diagonalStyle/RelativeLayout/RelativeLayout
styles.xml
resourcesxmlns:android=http://schemas.android.com/apk/res/android;stylename=diagonalStyleitem
name=android:background@drawable/background/item/style/resources
background.xml
?xml
version=1.0encoding=utf-8?layer-listxmlns:android=http://schemas.android.com/apk/res/android;itemrotateandroid:fromDegrees=0android:toDegrees=45android:pivotX=50%android:pivotY=50%shapeandroid:shape=lineandroid:top=1dipstrokeandroid:width=1dipandroid:color=#FF//shape/rotate/item/layer-list
--
--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups
Android Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups
Android Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.