Android教程網
  1. 首頁
  2. Android 技術
  3. Android 手機
  4. Android 系統教程
  5. Android 游戲
 Android教程網 >> Android技術 >> Android開發實例 >> activitygroup 切換動畫效果如何實現

activitygroup 切換動畫效果如何實現

編輯:Android開發實例

**一下提供偽代碼,僅說明自己的理解,思路**/
/*************************************************/
/*假設*/
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)
  1. 上一頁:
  2. 下一頁:
熱門文章
閱讀排行版
Copyright © Android教程網 All Rights Reserved