How rotate line in Android XML?

前端 未结 2 600
囚心锁ツ
囚心锁ツ 2020-12-15 06:01

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:



        
2条回答
  •  猫巷女王i
    2020-12-15 06:40

    You really only needed one number change to get it to work. Just Change the fromDegrees to 45:

    
        
            
                
            
        
    
    

    The rotate drawable http://developer.android.com/reference/android/graphics/drawable/RotateDrawable.html

    actually uses the Property Animation format http://developer.android.com/guide/topics/resources/animation-resource.html

    Whereas you are making a non-animating diagonal line, you want it to start out at 45 degrees, and end up at 45 degrees also. So setting them both to 45 is the norm.

提交回复
热议问题