I want to rotate a TextView, but I cannot get the correct output. I get a textView with some text missing
In the layout
<?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>
In animation
<?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>
Java file
import android.app.Activity; import android.os.Bundle; import android.view.animation.AnimationUtils; import android.view.animation.RotateAnimation; import android.widget.TextView; public class VDemo extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); TextView tv = (TextView)findViewById(R.id.text); RotateAnimation ranim = (RotateAnimation)AnimationUtils.loadAnimation(this,R.anim.myanim); ranim.setFillAfter(true); tv.setAnimation(ranim); } }
source share