Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Have an arbitrary View slide under another View like the software keyboard does

Tags:

android

I want to have a View pop in at the bottom of the page exactly like the software keyboard view does in the compose section of the Mms app. It slides in from the bottom, as if it's being added to a vertically oriented LinearLayout, only making the ListView smaller. It becomes a part of the current layout instead of popping up over the top of it. I'd like to to this exact thing with my own custom View.

Does the question make sense at all?

like image 708
synic Avatar asked Feb 13 '10 22:02

synic


1 Answers

Sure it makes sense!

I have a SlidingPanel demo that demonstrates the general technique. It's a bit more complicated than it needs to be, since it implements a custom View class.

The gist is you actually have your panel in the layout to begin with, positioned where you want it to be, but you set android:visibility="gone" so it doesn't appear. When you want it visible, make it visible and set up a TranslateAnimation to slide it in.

like image 94
CommonsWare Avatar answered Oct 27 '22 15:10

CommonsWare