rendered paste body@Override
public View makeView() {
TextView t = new TextView(this);
t.setTextSize(24);
t.setTextColor(0xffffffff);
t.setGravity(android.R.attr.layout_centerVertical);
t.setPadding(80,50, 0, 0);
LayoutParams lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.FILL_PARENT);
lp.addRule(RelativeLayout.CENTER_IN_PARENT);
t.setLayoutParams(lp);
t.setVisibility(View.VISIBLE);
return t;
}
in onCreate:
Animation in = AnimationUtils.loadAnimation(this, R.anim.push_up_in);
Animation out = AnimationUtils.loadAnimation(this, R.anim.push_up_out);
textSwitcher.setInAnimation(in);
textSwitcher.setOutAnimation(out);
push_up_in.xml:
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromYDelta="100%p" android:toYDelta="0" android:duration="1000"/>
<alpha android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="1000" />
</set>
push_up_out.xml:
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromYDelta="0" android:toYDelta="-100%p" android:duration="1000"/>
<alpha android:fromAlpha="1.0" android:toAlpha="0.0" android:duration="1000" />
</set>