I want to do in my app a View that I can swipe from the bottom of the window (Images below explain it better).
I want the view to stop at certain point. The view must allow to swipe/drag it to the bottom again. Any idea or tip of how can I do that?
I think you are in search of a ViewDragHelper:
API doc:
https://developer.android.com/reference/android/support/v4/widget/ViewDragHelper.html
How to use. This answer links to a sample project to show you how as well:
ViewDragHelper: how to use it?
Dragging best practices:
http://developer.android.com/training/gestures/scale.html
You can use the new material design pattern called Bottom Sheets.
They do the exact thing that you want. They also support custom layouts for the view.
Material Design - Component - Bottom Sheets
Related
I want to create a layout as shown below where I can load items in a recycler view. How can it be done?
I am new to android and I checked the type of dialog but somehow didn't find appropriate the appropriate XML code.
help will be appreciated Thanks
The component in the image is called a Bottom Sheet. It is a part of material components by google. You can take a look at how to create Bottom Sheets here: https://material.io/develop/android/components/bottom-sheet-behavior/
Here are some things to keep in mind while implementing a bottom sheet: https://material.io/design/components/sheets-bottom.html#anatomy
Hopefully this helps!
I went through many questions regarding making bottom bar but my my question is a bit different.I want to make this.
bottom menu:
Now the thing is, the menu is not static.It's items can vary depending upon user's choice.So, I have to make it dynamic. What's the best approach to achieve this?
Also, I'm not sure how do I make that curved outline at the center item.I'm thinking that I should do it programmatically.Any suggestions are welcome.Even better if you can share code.
Use this to create Navigation bar, it will surly create view that you show us in image.
https://github.com/armcha/Space-Navigation-View
Bottom menu is now an official navigation view according to the official documentation but as far as I know, there is no native component available yet to implement that.
In my opinion, your best bet is to try customizing the following library created by Iiro Krankka (http://github.com/roughike):
BottomBar
I would like to implement two Material Design elements in Android:
the Floating Action Button (FAB)
"shifting views" (not sure if this is the proper term)
I cannot find any Android widget to implement FABs. Which is the best recommended solution? is it to use third party libraries?
With "shifting view", I mean a view that shifts up and down. For example if you have two views in a fragment: top view which is fixed, and the bottom view which is a list, by scrolling the list, you can actually make the list take some space of the top view. How do you implement that? is it part of the Android framework or you need to use some third party libraries again?
There's no stock Android implementation of FAB, but I've used this implementation of FAB's in couple of my projects and its working great and supports the material greatness!
so given the fact that there's no FAB implementation on Android, you should go for a 3rd party implementation
By shifting views do you mean like toolbar? Like similar to this or this? Its hard to say, now knowing exactly the use case or what do toy mean, but this is what your explanation reminds me of
This one here might be pretty useful for any of the other material needed elements (widgets, dialogs, progress bars) and it also covers the FAB. As stated in the other answer, there is no default implementation so the solution would be to go for 3rd party libraries.
And here you can find different ways of implementing what you refer to as "shifting view". There is a demo app as well and it is easily customizable.
I am getting curious to know that how a view can be created like the one shown below . Is this drag and drop or some custom view with gesture detection and animations? What can be a good starting point?
ViewDragHelper can be used to achieve this effect. Some good tutorials and samples are: dragging-with-viewdraghelper and each-navigation-drawer-hides-a-viewdraghelper and DraggablePanel and AndroidSlidingUpPanel
Checkout BottomSheetDialogFragment from new Material design, here is a good tutorial on how to do it
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!