2012-04-28 97 views
2

使用SDK 2.3的Android滑出動畫,剩餘空間被其它視圖

我有在屏幕的底部的視圖,我想滑出所以使用此代碼

 FrameLayout ll1 = (FrameLayout) findViewById(R.id.bottom_panel); 
     Animation anim1 = AnimationUtils.loadAnimation(this, R.anim.slideoutbottom); 
     anim1.setInterpolator((new 
        AccelerateDecelerateInterpolator())); 
     anim.setFillAfter(true); 
     ll1.setAnimation(anim1); 
     ll1.setVisibility(View.GONE); 

填充XML:

 <?xml version="1.0" encoding="utf-8"?> 
     <set xmlns:android="http://schemas.android.com/apk/res/android"> 
     <translate android:fromYDelta="0%p" android:toYDelta="45%p"   android:duration="500" android:zAdjustment="bottom"/> 
     </set> 

的問題我已經是有其正在擴大,以填補滑出視圖留下的空間在屏幕中間的視圖。我不希望發生這種情況,我只需要中間的視圖來保持它的位置,我會淡化這一個。

如何解決 感謝

回答

1

相反能見度設置爲View.GONE的,使用View.INVISIBLE

這樣,您滑出的視圖仍將佔據屏幕上的空間。