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/android"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"android:paddingBottom="@dimen/activity_vertical_margin"android:paddingLeft="@dimen/activity_horizontal_margin"android:paddingRight="@dimen/activity_horizontal_margin"android:paddingTop="@dimen/activity_vertical_margin"tools:context=".TestActivity"><RelativeLayoutandroid:layout_width="match_parent"android:layout_height="match_parent"android:layout_alignParentLeft="true"android:layout_alignParentTop="true"style="@style/diagonalStyle"></RelativeLayout></RelativeLayout> styles.xml <resourcesxmlns:android="http://schemas.android.com/apk/res/android"><stylename="diagonalStyle"><item name="android:background">@drawable/background</item></style></resources> background.xml <?xml version="1.0"encoding="utf-8"?><layer-listxmlns:android="http://schemas.android.com/apk/res/android"><item><rotateandroid:fromDegrees="0"android:toDegrees="45"android:pivotX="50%"android:pivotY="50%"><shapeandroid:shape="line"android:top="1dip"><strokeandroid:width="1dip"android:color="#FF0000"/></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.