activitygroup 切换动画效果如何实现

时间:2022-04-17 07:42:56
  1. **一下提供伪代码,仅说明自己的理解,思路**/ 
  2. /*************************************************/ 
  3. /*假设*/ 
  4. AActivity,BActivity,CActivity,DActivity 都extends ActivityGroup. 
  5. A1Activity,B1Activity,C1Activity,D1Activity 都extends Activity. 
  6. A2Activity,B2Activity,C2Activity,D2Activity 都extends Activity 
  7.  
  8. /*一,AActivity继承了Activity,调用startActivity()的时候会在tab内部contentView显示A1Activity*/ 
  9. AActivity.this.startActivity(A1Activity.class
  10. BActivity.this.startActivity(B1Activity.class
  11. CActivity.this.startActivity(C1Activity.class
  12. DActivity.this.startActivity(D1Activity.class
  13.  
  14. /*二,A1Activity没有继承ActivityGroup,所以调用startActivity()的时候和普通的调用没有区别,A2会填满窗口*/ 
  15. A1Activity.this.startActivity(A2Activity.class
  16. B1Activity.this.startActivity(B2Activity.class
  17. C1Activity.this.startActivity(C2Activity.class
  18. D1Activity.this.startActivity(D2Activity.class
  19.  
  20. /*三,A1Activity.this.getParent()获得的是AActivity, 其实就是ActivityGroup; 虽然A1Activity没有继承ActivityGroup,但是A2Activity实际是由A1Activity的父类AActivity启动的,所以A2Activity的启动效果和一差不多*/ 
  21. A1Activity.this.getParent().startActivity(A2Activity.class
  22. B1Activity.this.getParent().startActivity(B2Activity.class
  23. C1Activity.this.getParent().startActivity(C2Activity.class
  24. D1Activity.this.getParent().startActivity(D2Activity.class