I am making a textView
animate like the cast list after movie (slide into the screen and slide out the screen), however, the textView
is unable to display all my text even I use wrap_content
.
The layout xml:
<LinearLayout xmlns: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:background="#f2f1ef"
android:clipChildren="false"
android:paddingBottom="150dp"
android:paddingLeft="30dp"
android:paddingRight="30dp"
android:paddingTop="150dp" >
<TextView
android:id="@+id/story_txt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing"
android:textSize="60sp" />
</LinearLayout>
Slide up animation, slideup_in.xml:
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator"
android:fromYDelta="125%"
android:toYDelta="-150%"
android:duration="20000" />
Activity:
public class StoryActivity extends Activity {
TextView story_txt;
Animation animationSlideDownIn;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_story);
story_txt = (TextView) findViewById(R.id.story_txt);
Typeface face = Typeface
.createFromAsset(getAssets(), "font/secret.ttf");
story_txt.setTypeface(face);
animationSlideDownIn = AnimationUtils.loadAnimation(this,
R.anim.slideup_in);
animationSlideDownIn.setAnimationListener(animationSlideInListener);
story_txt.startAnimation(animationSlideDownIn);
}
AnimationListener animationSlideInListener = new AnimationListener() {
@Override
public void onAnimationEnd(Animation arg0) {
story_txt.setVisibility(View.INVISIBLE);
finish();
}
};
}