Android SlidingDrawer – Top Down Style
Customizing components can be fun! ….and sometimes annoying when a component’s default behavior is not what you expect or even not equiped to do what you want. Recently had a project, where the SlidingDrawer component was supposed to animate/transition from the Top -> Down. Yah, realized its a sought after feature…(I’m so lame!..ahahah).
Steps:
- Include the easing interpolator package (source included in the given download link below)
- Use the new namespace (panel) in your Android view XML eg. xmlns:panel=”http://schemas.android.com/apk/res/org.panel”
- Use the tag set instead of the Android SlidingDrawer component!
Download: AndroidTopDownSlidingDrawer.zip
File: main.xml
<?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:panel="http://schemas.android.com/apk/res/org.panel" android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <org.panel.Panel android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/topPanel" android:paddingBottom="20dip" panel:position="top" panel:animationDuration="1000" panel:linearFlying="true" panel:openedHandle="@drawable/top_switcher_expanded_background" panel:closedHandle="@drawable/top_switcher_collapsed_background"> <Button android:id="@id/panelHandle" android:layout_width="fill_parent" android:layout_height="33dip" /> <LinearLayout android:id="@id/panelContent" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:text="From the Top -> Down" android:textSize="16dip" android:padding="4dip" android:textStyle="bold" /> <ImageView android:src="@drawable/android_skateboard" android:layout_gravity="center" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout> </org.panel.Panel> </LinearLayout> </FrameLayout>
File: Test.java
package org.panel; import android.app.Activity; import android.os.Bundle; public class Test extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } }
Thanks for this useful tuto.
I have a problem when I changed the panel:position to right the handler button stay on the left side of the screen.
Somebody can help me?
Down”
android:textSize=”16dip”
android:padding=”4dip”
android:textStyle=”bold” />
i think your download link is break,can you modify it ? thank you
Hi Wang Peng,
Thanks for notifying me. Will upload again …ping me tomorrow just in case I forget!
not downloading..
please can you modify download link..
Hi Sakura & Wang Peng,
My file server host (FileFactory) seems to be moving my files around?
I have uploaded the code…link is updated.
Ok Done!
Thanks,
-W
thanks but i want to download zip. the link is breaking ,please can you change it…
Hi!
When I make a left-to-right slidingdrawer, the panelHandler disappear.
Need some help. Thks.
Your download link doesn’t seem to be letting me download the file. Any way you can post a new link or just edit the post to include the necessary code? Thanks for all of your help with this!
Thanks for the tutorial.
But i need the sliding drawer, sliding from left to right can anyone help.
Thank you.
Your download link wants to install “stuff”. Seems like a bad file hosting site.
How to Open and close this menu in java?
hey, i m anewbie..how do i include the interpolator package? i ahve downloaded it
WTF? Your link sends me to FileFactory where they are trying to FORCE me to pay them money for the privilege of downloading this file. There is no indication or guarantee that the file is even there and that I will be able to access it. Do they think I am that gullable? For that matter do you? Thanks for nothing!
Link is outdated since they closed down mediafire etc.
github: https://github.com/w2davids/Ghostdrive
click on zip
Any idea how to have a handle outside the panel and gets its events. For Ex: The handle button will be on top header bar, on click of this button the panel should slide down show its content. The handle should be separate from panel not attached.
Thanks a lot, finally i’m done! but i wonder how to make it a little easier or more simply.
Thanks a lot, finally i’m done! but i wonder how to make it easier and more simple way.
thank you very much for the tutorial. When I run the program and slid down the tab, the tab disappears. I can do so that the tab does not disappear. thank you very much
Sorry, my English is not very good.
How we can create a slider drawer from left to right flow.
by default we got bottom to top.
and when we want to use right to left ,we will use horizontal orientation in slider tag.
how we can build it from left to right.
Thanks in advance
Can we use this code freely for commercial use? In general, what are the licencing policies for the code posted on this blog.
Thank you very much, really great.
Sorry, i don’t get it. How implement this?
Congratulations, this works fine!!
I want to include this in my project, but i need the animation from bottom to top, and I’m trying to do this and I can’t get to work. Can you help me on this?
Thanks.
make sure to give proper credit to the creator of the library … wich is found here: https://code.google.com/p/android-misc-widgets/
an anybdy help me in including this in my project? what are the steps to follow for using this… Newbie here!
Thanks for developing this.
followed steps this dont work only his example works. I think more steps needed to make this work
1 Pingback
GOOGLE
Recent Posts
Archives
Categories
Meta