I was wondering if someone could guide me on how to accomplish the following,
The user has a title bar, when the user holds the title bar and drags down; it shows the user a different view. This is a view residing in a tabhost.
It is similar to android's default statusbar.
You should try to accomplish this (an AccordionView-like behavior) using
ViewFlipper
withRelativeLayout
children and attached OnTouchListeners on theheader
s. It worked for me.Sample application
main.xml //inside
res/layouts
androidManifest.xml //activity declaration only
AccordionSample.java //your main activity
AccordionAnimation.java //for the up and down sliding
strings.xml //inside
res/values
Edit
If you'd like to split your different views into different layout xmls, say
you should modify your
onCreate
method:Edit
or more elegantly and efficiently, simply just include the layout xmls you've created for the different views into your
main.xml
:where
layout/flipping_view_1.xml
contains the firstRelativeLayout
, andlayout/flipping_view_2.xml
contains the secondRelativeLayout
of the
ViewFlipper
inside your original main.xml.To learn more about the reusability of android layouts, and layout techniques overall, you should take a look at Romain Guy's great post covering layout tricks.
See these two posts for pointers - Android: Have an arbitrary View slide under another View like the software keyboard does and How can I make my page slide as the user slides finger on the screen?