I created two xml files push_left_in.xml under res / anim, push_left_out.xml
push_left_in.xml:
android: duration = "2000" />
push_left_out.xml:
android: duration = "2000" />
Jump code:
final Intent i = new Intent ();
i.setClass (MainActivity.this, Login.class) ;/ / logged in to jump to the login screen
startActivity (i);
overridePendingTransition (R.anim.push_left_in, R.anim.push_left_out);
finish () ;/ / jump successfully, close the current page
Why jump when the effects do not show a jump? Where is not wrong or missing set?<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Set ----> Display ----> Animation ----> All animation, try to open the entire animation.
Reply:
My phone displays this option there is no animation
Reply:
I tried an example of others, can run effective, but why this has no effect on my own it
Reply:
Some long time to try to set
Reply:
The same is true
Reply:
There's why I have not tested Huawei phone problems, but tests on the phone in the Sony flash back, click on the program icon after installing a program to stop responding to prompt exit? Huawei is Android 4.1.1 Sony is 4.1.2
Reply:
You put off animation, right? Look in the settings. Open animation
Reply:
I looked at the animation is not related to me this is to open the first page, three seconds after the jump to another page, if you jump on its own with no effect, if the first page is displayed on the display when the Slide on the screen from right to left (did not write any code for this event) when he jumps when there is effective, and why Huawei phones can run, but in the Sony phone but flash back then? ?
Reply:
Will it be too early to finish execution, has not had time to run the animation quit.
finish () ;/ / jump successfully, close the current page
Reply:
I tried to finish () nor annotated sentence
Reply:
How could this be, always show no effect - exactly what the problem is, where is
Reply:
May be a matter of time, plus a sleep (5 * 1000) try.
Reply:
Tried or not
Reply:
I tried another method, add a button on the page, set the listener, and then click on the code in the event there is no problem, but let him jump automatically after three seconds would not have this effect the
@ Override
protected void onCreate (Bundle savedInstanceState) {
super.onCreate (savedInstanceState);
setContentView (R.layout.activity_main);
/ / Intent i = new Intent ();
Timer timer = new Timer ();
TimerTask tast = new TimerTask () {
@ Override
public void run () {
/ / TODO Auto-generated method stub
userInfo = getSharedPreferences ("info", MODE_WORLD_READABLE);
String username = userInfo.getString ("username", "") ;/ / determine if already logged
if (username! = "") / / not equal to empty proven already logged
{
Intent i = new Intent ();
i.setClass (MainActivity.this, Main.class) ;/ / Jump to the main interface has logged
startActivity (i);
overridePendingTransition (R.anim.push_left_in, R.anim.push_left_out);
finish () ;/ / jump successfully, close the current page
}
else / / otherwise prove not logged
{
Intent i = new Intent ();
i.setClass (MainActivity.this, Login.class) ;/ / logged in to jump to the login screen
startActivity (i);
overridePendingTransition (R.anim.push_left_in, R.anim.push_left_out);
finish () ;/ / jump successfully, close the current page
}
}};
timer.schedule (tast, 3000) automatically jump
;/ / 3 seconds}
No comments:
Post a Comment