2014-03-26 69 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中,你可以得到一个弹出窗口,你应该改变它来获得你想要的东西:) –