In order to implement a navigation bar ala Facebook I have the following layout configuration:
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<!-- This is the Lower Layer hosting the navbar -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<!-- ListView representing the navbar -->
<ListView
/>
</LinearLayout>
<!-- This is the Top Layer hosting the Content -->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<!-- This is where the View of the Content will be injected -->
</FrameLayout>
</FrameLayout>
So the basic idea is that when I want to open the navbar I just shift the TopLayer to the right and the navbar will be revealed.
Now this works well and I can interact with the navbar's ListView
in order to navigate through the application, as far as the view that gets injected inside the TopLayer
isn't a ScrollableView
(like another ListView
, a ScrollView
or a WebView
).
For instance, when the TopLayer
is a WebView
instance, I can't scroll and interact with the navbar's ListView
because it is the WebView
that gets scrolled (althoough I shifted it to the right).
I guess it's not trivial to superpose many ScrollableView
's but I hope there are hacks to overcome these issues.
Thanks for your help!
EDIT
By the way, this is how I am shifting the TopLayer
view (using TranslateAnimation):
TranslateAnimation translateAnim = new TranslateAnimation(0.0F, mListView.getWidth(), 0.0F, 0.0F);
translateAnim.setDuration(..);
translateAnim.setFillAfter(true);
mTopLayerView.startAnimation(translateAnim);