In my app there a button , and on pressing it the requirement is that an expandable list view should slide out. but the case is that slidingdrawer only moves from bottom to top..
You can try umano's https://github.com/umano/AndroidSlidingUpPanel. Just copy it and see if it fits
This was asked in a similar question: Android SlidingDrawer from top?
To summarize, there are basically two solutions:
On Android 3.0+ (API 11), you can set android:rotation on the SlidingDrawer to 180 degree. And since that will also rotate the children, rotate them an additional 180 degree, to return them to their original orientation. However, since SlidingDrawer was also deprecated in Android 4.2 (API 17), this solution is not recommended as anything more than an interim solution.
The better solution is to write you own implementation or use a similar component from a 3rd party widget library. A few library recommendations can be found in the answers for this question: SlidingDrawer deprecated
Related
What is the correct way to notify Android that I need touches on the left side of the screen for a drawer pull-out? Right now on Q beta 3 it goes back rather than pulling out the drawer. I looked for documentation but couldn't find any.
You should NOT use systemGestureExclusionRects api for Navigation Drawer or any other controls which would result in opting out the whole left/right edge as this will result inconsistent behavior.
DrawerLayout has out of box support for system gestures. All you need to do is update the dependency to '1.1.0-alpha01' and build against Q.
You can refer to this devbyte and this I/O session for more details.
From the preview docs on gestural nav, View now has the method setSystemGestureExclusionRects https://developer.android.com/reference/kotlin/android/view/View.html#setSystemGestureExclusionRects(kotlin.collections.MutableList)
According to Chris Banes (Android Developer Relations at Google):
The drawer behavior is changing. Users will be able to open the drawer
by peeking the drawer, and then swiping. Big benefit is that this
works with existing apps with "old" DrawerLayout versions.
You can find an animation of what he's talking about in his tweet.
I guess we don't have to do anything, just make sure to update our gradle dependencies. Maybe they will change it again in the next version.
Im trying to get the same result as new google maps, when you "tap" on any "marker" you get a little layout in bottom of the screen, all the info about the srteet view and other details shown there, when you hold and move your finger to top of the screen the layout moves and c over all screen or half of the screen. i was thinking use slidingDrawer but seems google depreceate this method on api 17. so how i can achieve this?
Im attaching the image of example:
you could look into using this SlidingUpPanel which appears to be exactly what you are looking for
Now from with Android Support Library 23.2 we can use Design Support Library: Bottom Sheets
Something that might be worth looking into is the answer to this question.
More specifically the answer that links here.
Basically the idea is that They realized that the sliding drawer left some things to be desired and they created a custom component with similar functionality. This will give you more freedom and a way around using deprecated classes. Let me know in comments if there's anything else that would be helpful to know.
Happy coding!
I'm trying to create a sliding panel that slides to collapse / expand vertically and not horizontally.
I've tried Umano's Library but it's kind of buggy for me, because I'm using Fragments, and not Activities.
Any way to implement this with fragments?
Thanks.
that is called a SlidingDrawer (which is deprecated as of API level 17 BTW) so I would not recommend using it unless you fork it from the SDK as your own
SlidingDrawer Examples:
http://www.coderzheaven.com/2011/12/01/slidingdrawer-in-android-a-simple-example/
http://androiddeveloperspot.blogspot.com/2013/05/slidingdrawer-in-android-example.html
http://w2davids.wordpress.com/android-damn-that-sliding-drawer/
SlidingPaneLayout does this SlidingPaneLayout provides a horizontal, multi-pane layout for use at the top level of a UI. A left (or first) pane is treated as a content list or browser, subordinate to a primary detail view for displaying content.
you can view the sliding pane in the new hangouts app
Well if any one wants to know,
i Did used Umano's Library
bugs were fixed using the git manager.
Works great.
I need to incorporate a youtube like drawer navigation drawer for both(left,right) sides. AFAIK android apis don't provide means for the right-to-left drawer functionality. There're quite a lot of implementations out there(sliding menu) which do.
This sliding menu feature seems to present a performance issue. Should I try to rewrite original NavigationDrawer, which I expect to be the least performance-impact solution, or there is another performance-optimal library?
Thanks.
I would choose NavigationDrawer. I used both and I find NavigationDrawer smoother. If you try to mimic google UX then with NavigationDrawer should be enought for your needs.
I recently made a project/demo to implement NavigationDrawer with ActionBarSherlock for pre Honeycomb devices because I need for an app.
SherlockNavigationDrawer impl
Another thing to take in mind is that if you use NavigationDrawer try to avoid Tabs because all the tabs items could fit perfectly as a listview in NavigationDrawer.
Actually NavigationDrawer supports drawers on both edges.
You have to supply the two drawer views inside your layout xml; one with gravity:left and one with gravity:right.
Then, in your Activity you call setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED) on your DrawerLayout object.
This will enable swiping either from left or right edge.
#MichaĆ The question is actually implementation of both left as well as the right drawer.
#midnight NavigationDrawer right now only implements one-sided menu which you can place either on the left or the right. If you want to implement the other pane also you can make your content layout as SlidingPaneLayout.
This was also added to the latest support library along with the NavgationDrawer. For an implemented example you can look at the newest Hangouts app on how they are using it. This layout will probably suit your purposes better rather than rewriting the NavigationDrawer. In any case i'd hold off on re-writing it since it is the first release of the Layout and may undergo changes fairly quickly.
Since the last version of SupportLibrary there is a NavigationDrawer in Android.
I want to create a custom title bar, somewhat like this, in my Android app. Please pardon if my question seems idiotic, I'm a beginner. Can anyone tell me if it is a titlebar or an Action bar? Plus how can I give this Shaded Black color to my titlebar/action bar?
PS: I'm using GingerBread on my Android. My app will require minimum SDK version to be 4 but it targets Jelly bean too. In GingerBread, I can't make use of ActionBars. Please help me with the problem. It would be highly appreciated.
You will want to use the ActionBarSherlock library for this (which will allow you to use this all the way back to SDK version 4).
It is reasonably easy to style, and is for sure the right way to do this. Lots of examples for this, as it is a very popular library.
http://actionbarsherlock.com/
If you are wanting to target min API 4, then as you state you'll be unable to use the ActionBar.
So you could just create your bar as a LinearLayout or something with whatever buttons / icons you want on it and have it at the top of all of your Activities. If you have many of them it would probably be worth it to refactor the Bar (click handlers and such) handling into a subclass of Activity, and then extend that with all of your other activities.
The visual effect could be easily achived with a 9-patch png set as the background of a LinearLayout. Just make the gradient you want in photoshop/Gimp and drop it into draw9Patch to add the pixels on the edge that will allow it to stretch nicely to fit any screen.
Edit: using actionbar sherlock as others suggested is probably a better idea than doing it "manually" as I suggested.