亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

android.R.anim.fade_out 不好用,只是淡入工作

android.R.anim.fade_out 不好用,只是淡入工作

哈士奇WWW 2022-10-12 09:51:47
我想在帶有動畫的片段之間切換。當前,我使用這個:FragmentTransaction fr = getFragmentManager().beginTransaction();//fr.setCustomAnimations(R.anim.enter, R.anim.exit, R.anim.pop_enter, R.anim.pop_exit);fr.setCustomAnimations(android.R.anim.fade_in,android.R.anim.fade_out);fr.replace(R.id.fragment_container,new SwimSuitFragment());fr.addToBackStack(null);fr.commit();效果很好,但是當我按下它時,fade_in它會直接轉到上一個片段,并且不做淡出動畫。
查看完整描述

1 回答

?
牧羊人nacy

TA貢獻1862條經驗 獲得超7個贊

來自官方文件;

popEnter 和 popExit 動畫將播放進入/退出操作,特別是在彈出返回堆棧時。

public abstract FragmentTransaction setCustomAnimations (int enter, 
                int exit, 
                int popEnter, 
                int popExit)

你應該使用它而不是你的setCustomAnimations

fr.setCustomAnimations(android.R.anim.fade_in,android.R.anim.fade_out,android.R.anim.fade_in,android.R.anim.fade_out);


查看完整回答
反對 回復 2022-10-12
  • 1 回答
  • 0 關注
  • 130 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號