0

I have been toying with a few different libraries and code snippets for the past few days. I am trying to create a menu like the one seen in the facebook app. Now there are many libraries and resources on building something of that kind, but I'm having major difficulties in drawing a shadow between the 'top' and 'bottom' page as to create the illusion that the 'top' page is actually on top. Now the exact effect Im trying to create is displayed in this article: http://android.cyrilmottier.com/?p=717

The author of the article I got this from is not very thorough in his explanation. This could be due to my programming-skills-under-development, or maybe I'm not the only one. I'm using the following library and example app to test and develop with: https://github.com/jfeinstein10/SlidingMenu

I would be very happy if anyone could help me get this to work.

PS: I'm very sorry, but since I'm a newbie here I am not allowed to post any pictures.

Simon Sarris
  • 62,212
  • 13
  • 141
  • 171
Daft Fox
  • 133
  • 10

1 Answers1

0

What I did is I'm putting a shadow at the right of my menu view (ie behindView) with a margin on the right of your above view :

<!-- Show shadow on the right of the menu -->
    <RelativeLayout 
        android:id="@+id/menuShadow"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:focusable="false"
        android:clickable="false"
        android:background="#00000000"
        android:layout_marginRight="40dp">
        <ImageView 
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            android:layout_alignParentBottom="true"
            android:layout_width="6dp"
            android:layout_height="fill_parent"
            android:background="@layout/border_menu_progressive_shadow"/>
    </RelativeLayout>

With my shadow layout:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item>
        <shape>
            <gradient
                android:startColor="#00101010"
                android:endColor="#252525"
                android:angle="0" />
        </shape>
    </item>

</selector>
Camille R
  • 1,433
  • 2
  • 17
  • 29
  • This is something I have tried myself. While it does provide the effect I'm looking for AFTER the menu has been pulled and not while it's being pulled. – Daft Fox Jul 11 '12 at 14:54
  • true, you can use a translation animation to follow the movement of the above view with the shadow if you know the speed or distance and time – Camille R Jul 11 '12 at 14:57
  • I will work on moving the shadow around later. Will keep you updated if I may succeed. – Daft Fox Jul 23 '12 at 15:10