2016-12-22 39 views
8

在我的根佈局我有機器人:animateLayoutChanges =「真」與setVisibility(View.GONE)

android:animateLayoutChanges="true" 

這使得完美的動畫,當我做一些搜索可見這是以前在View.GONE狀態。佈局完美展開。 但是,當我嘗試刪除視圖與

setVisibility(View.GONE) 

它使它看起來突然。該視圖立即消失,但layoutchanges動畫從視圖開始,它使它看起來像視圖消失兩次。 請幫幫忙!:)

+0

也許這會幫助你? http://stackoverflow.com/questions/3995215/add-and-remove-views-in-android-dynamically –

+0

@Konstantin任何解決方案?或者你採用自定義動畫而不是animateLayoutChanges? – f470071

+0

@ f470071我現在使用custom和animateLayoutChanges。 –

回答

0
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { 
       faqLayoutBinding.faqListLayout.getLayoutTransition() 
         .enableTransitionType(LayoutTransition.CHANGING); 
      } 

添加此代碼。這將解決問題

相關問題