正如标题所示,我的手机在Android转换之间显示黑屏。 这是我的java主要活动代码:
public class Main extends AppCompatActivity {
int h=0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
public void a ( View view){
startActivity(new Intent(getApplicationContext(), MainWithButtons.class));
overridePendingTransition(R.anim.left_in, R.anim.left_out);
}
}
这里是java第二个活动:
public class MainWithButtons extends AppCompatActivity{
@Override
protected void onCreate( Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_with_buttons);
}
}
left_in.xml:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator">
<translate
android:duration="400"
android:fromXDelta="0"
android:toXDelta="100%p"/>
</set>
left_in.xml:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator">
<translate
android:duration="400"
android:fromXDelta="-100%p"
android:toXDelta="0"/>
</set>
当我评论overridePendingTransition方法时,我可以打开第二个活动,所以onClick不是问题。
答案 0 :(得分:0)