首页 > 系统 > Android > 正文

activitygroup 切换动画效果如何实现

2020-04-11 12:40:03
字体:
来源:转载
供稿:网友
**一下提供伪代码,仅说明自己的理解,思路**/
/*************************************************/
/*假设*/
AActivity,BActivity,CActivity,DActivity 都extends ActivityGroup.
A1Activity,B1Activity,C1Activity,D1Activity 都extends Activity.
A2Activity,B2Activity,C2Activity,D2Activity 都extends Activity

/*一,AActivity继承了Activity,调用startActivity()的时候会在tab内部contentView显示A1Activity*/
AActivity.this.startActivity(A1Activity.class)
BActivity.this.startActivity(B1Activity.class)
CActivity.this.startActivity(C1Activity.class)
DActivity.this.startActivity(D1Activity.class)

/*二,A1Activity没有继承ActivityGroup,所以调用startActivity()的时候和普通的调用没有区别,A2会填满窗口*/
A1Activity.this.startActivity(A2Activity.class)
B1Activity.this.startActivity(B2Activity.class)
C1Activity.this.startActivity(C2Activity.class)
D1Activity.this.startActivity(D2Activity.class)

/*三,A1Activity.this.getParent()获得的是AActivity, 其实就是ActivityGroup; 虽然A1Activity没有继承ActivityGroup,但是A2Activity实际是由A1Activity的父类AActivity启动的,所以A2Activity的启动效果和一差不多*/
A1Activity.this.getParent().startActivity(A2Activity.class)
B1Activity.this.getParent().startActivity(B2Activity.class)
C1Activity.this.getParent().startActivity(C2Activity.class)
D1Activity.this.getParent().startActivity(D2Activity.class)
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表