2014-03-26 72 views
0

任何人都可以指向一個示例或一個用於滑動窗口的lib。我有一個應用程序,並且我想要從顯示信息的屏幕底部向用戶滑動一個窗口。Android向上滑動窗口

我希望窗口只能向上滑動一點以顯示信息。有點像一個用戶的Hnt,可能是屏幕的四分之一。

此窗口可以手動解除或定時器。我正在尋找這樣做xamarin,但一個java的例子也會有所幫助。

+0

如果我理解正確,您可以使用TranslateAnimation完成此操作。 – Bob

+0

啊,是的,這就是我想要的一個例子,看看我將如何創建窗口並使用TranslateAnimation來顯示它。 – LilMoke

+0

是你想要的嗎? http://stackoverflow.com/questions/14452938/vertical-sliding-menu-in-android –

回答

0

您可能需要更改此方法中的某些變量。 我在我的一個應用程序中使用這個。動畫從下到上設置相對佈局

private void animate(){ 
     RelativeLayout rl = (RelativeLayout)findViewById(R.id.yourLayout); 
     AnimationSet set = new AnimationSet(true); 

     Animation animation = new TranslateAnimation(
       Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, 
       Animation.RELATIVE_TO_SELF, 0.85f, Animation.RELATIVE_TO_SELF, 0.0f 
       ); 
     animation.setDuration(250); 
     set.addAnimation(animation); 

     LayoutAnimationController controller = new LayoutAnimationController(set, 0.25f); 
     rl.setLayoutAnimation(controller); 
    } 
+0

是的,這看起來不錯,謝謝!它是否會一直向上滑動,理想情況下,我只想將它向上滑動1/4或更少......有點像給用戶的提示。 – LilMoke

+0

您可以在TranslateAnimation構造函數參數中控制「滑動量」。 – Bob

+0

更改新TranslateAnimation()中的值。如果你複製代碼粘貼到Eclispe中,你可以得到一個彈出窗口,你應該改變它來獲得你想要的東西:) –