片段到活动动画不适用于overridePendingTransition();

时间:2017-12-13 04:20:05

标签: java android android-fragments android-activity android-animation

我想在从public PXAction<MABUIPDocument> BtnCreatingNew; [PXButton(CommitChanges = true)] [PXUIField(DisplayName = "Test Creating new item", Visible = true)] protected virtual IEnumerable btnCreatingNew(PXAdapter adapter) { MABUIPDocument row = Documents.Current; row.DocumentDesc = "Test" + DateTime.Now.ToString(); row = Documents.Update(row); Actions.PressSave(); adapter.Searches[adapter.Searches.Length - 1] = row.DocumentNbr; return adapter.Get(); } 切换到活动但是功能

时切换动画
fragment

overridePendingTransition(R.anim.slide_in_up, R.anim.slide_out_up ); 中以Cannot resolve method标记为红色。

在活动中它运作良好。我怎样才能使它发挥作用?

1 个答案:

答案 0 :(得分:2)

  

带有红色标记,无法解析片段中的方法overridePendingTransition(R.anim.slide_in_up, R.anim.slide_out_up );

因为 overridePendingTransition(R.anim.slide_in_up, R.anim.slide_out_up );活动方法不属于Fragment

试试这个

  getActivity().overridePendingTransition( R.anim.slide_in_up, R.anim.slide_out_up );