Android的頁面切換動畫學習筆記
實作兩個頁面滑動切換,一些相冊的效果也是如此
一個Activity的界面配置檔案
activity_main.xml:
MainActivity.java:
在res/anim/檔案夾下有
enter_lefttoright.xml和enter_righttoleft.xml
out_lefttoright.xml和out_righttoleft.xml
四個動畫配置檔案:
enter_lefttoright.xml:
enter_righttoleft.xml:
out_lefttoright.xml:
out_righttoleft.xml:
效果:用手向右滑動,整個頁面向右慢慢滑動,切換頁面,用手向左滑動,整個頁面向左慢慢滑動,切換頁面。
(将配置檔案換成其他的動畫效果也可以,本例子使用的是移入移出的動畫效果)