How to implement a rolling view (for example, a feed in a facebook application)

I'm not sure how to do this? I want a static view at the bottom of another layout that the user can slide to show a different view. I'm not sure what this function is called, but I know that the Facebook application does this, and ESPN and Google plus. Thanks!

+4
source share
1 answer

The simplest thing to use is a SlidingDrawer .

As long as you want to slide from below (or to the right), this will work beautifully. This does not work if you want to move something on top or on the top left.

To use it, you just need something like this in your XML layout:

<SlidingDrawer android:id="@+id/drawer" android:layout_width="match_parent" android:layout_height="match_parent" android:handle="@+id/handle" android:content="@+id/content"> <ImageView android:id="@id/handle" android:layout_width="88dip" android:layout_height="44dip" /> <GridView android:id="@id/content" android:layout_width="match_parent" android:layout_height="match_parent" /> </SlidingDrawer> 

If ImageView is a β€œhandle” (what you drag up and down to open a drawer), and a GridView is the content you want to keep in the drawer (it can be any type of view, not just the GridView).

+9
source

All Articles