我想旋转TextView但我无法获得正确的输出。我错过了一些文字<{1}}
布局
textView
动画
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_marginTop = "50dip">
<TextView android:layout_width="wrap_content" android:gravity="bottom"
android:layout_height="wrap_content" android:id="@+id/text"
android:text="Shreeji \n Nath" />
</RelativeLayout>
Java文件
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="40" android:toDegrees="-90" android:pivotX="40%"
android:duration="0">
</rotate>
答案 0 :(得分:2)
将main.xml更改为:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<TextView android:layout_alignParentLeft="true"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="TextView" android:layout_marginTop="50dip"
android:layout_marginLeft="50dip" android:id="@+id/text1"></TextView>
</RelativeLayout>
答案 1 :(得分:1)
在API级别12中添加
view.animate().rotationBy(90).start()