1

Can anyone point me to an example, or a lib to use for a slide up window. I have an app and on an action I want to slide a window up from the bottom of the screen that displays info to the user.

I would like the window to slide up only a little bit to show the info. Kind of like a hnt to the user, maybe 1/4 way up the screen.

This window can be manually dismissed or on a timer. I am looking to do this with xamarin, but a java example would also help.

LilMoke
  • 3,176
  • 7
  • 48
  • 88

1 Answers1

1

You might have to change some of the variables in this method. I use this one in one of my apps. Animates a relativeLayout from bottom to top

 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);
    }
Joakim Palmkvist
  • 540
  • 2
  • 11
  • Yes, that looks great, thanks!!! Does that slide it up all the way, ideally I would like to only slide it up 1/4 of the way, or less… sort of like a hint to the user. – LilMoke Mar 26 '14 at 13:38
  • you can control the "amount of sliding" in the TranslateAnimation constructor parameters. – Bob Mar 26 '14 at 13:39
  • Change the values inside new TranslateAnimation(). If you copy paste the code inside Eclispe you can get a popup of what value you should change to get what you want :) – Joakim Palmkvist Mar 26 '14 at 13:39
  • I will fool with it, thank you. I am looking at the api call know to see the params. If I run into a something, I know where to go!!! – LilMoke Mar 26 '14 at 13:42
  • So,when I try basically the same as the code above findViewById always returns null, what could I be doing wrong? – LilMoke Mar 26 '14 at 21:27
  • I dont think your layout has been loaded, thats usually why it returns null. Post your code and Ill have a look. – Joakim Palmkvist Mar 27 '14 at 07:16