I'm trying to use the BottomSheetBehavior from Material. The problem is that it is not well described and no enough examples of it are available.
One example on Meduim, but it only shows the basics and very simple implementation.
What I exactly need is something like the one from Material here. But instead of clicking on the menu item to show the BottomSheet, I want to show it when user selects an item from RecyclerView. Also the peek height should show only the first element in the BottomSheet layout until the user pulls it up.
How to get this approach? Are there any useful example?
Make the bottom sheet hidden when you start your activity or fragment by calling bottomSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN).
And in your adapter's onClick, make the bottom sheet visible, by calling bottomSheetBehavior.setState(BottomSheetBehavior.STATE_HALF_EXPANDED)
Related
Look at this video: https://ibb.co/37V0Vgt. I wanted to create a activity with the bottom view(in the video) which you drag up and down. The view also snaps in two positions.
when it is fully expanded
all the way down
I have been searching for a way to create this kind of view but have found nothing. The problem is if you have a view at the bottom how can you expand it up just like in the video.
What I want is a solution on how to implement this kind of view. You would add it to the bottom of your activity layout and behave exactly like in the video. Is this something which already exists? Then what is it called?
This is a Botom Sheet. You can place a layout inside a CoordinaterLayout and apply the BottomSheetbehaviour to it to create this view.
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior"
You'll require the Material Components Library as stated here.
In your video, the Bottom Sheet is in the STATE_COLLAPSED state and can be pulled out.
I need to achieve the following behavior:
I have an activity with some data and views in it. At the bottom there is a search bar. What I need is to make RecyclerView slide into the screen or just pull it up when you start typing in the search bar. When RecyclerView is on the screen and user keeps scrolling down I need to collapse it back to the starting position.
What would be the right approach to achieve this behavior?
You can use BottomSheetDialog as an option and put there your recycler as a part of its layout.
Here is the design guidelines and here is the implementation.
I need to make a layout similar to that Image.
I wish it were shown all the registered images and their attributes and a button to add the user would select an image and define the attributes of it. I do not want a complete example that ordered but at least one direction than I use to do the layout. By my research I should perhaps use a swipe view. Has anyone seen something similar?
Thank you
You can use ViewPager to display cards like in top part.
ViewPager with previous and next page boundaries
And use a ListView or RecyclerView to show the bottom part. https://code.tutsplus.com/tutorials/getting-started-with-recyclerview-and-cardview-on-android--cms-23465
I am working on an android application and want to implement a functionality in which I want to show a layout which will contain Like/Comment of that content at the bottom of the page.
I want this layout to be shown when I scroll up the page and hide when I scroll down the page.
I have scene many applications that have implemented this feature, but I have no idea how to implement this feature in my app.
Please check this link of the app which is giving the same functionality which I want to implenment https://play.google.com/store/apps/details?id=com.midsizemango.materialapps
Please help if anyone have idea here, Thanks a lot in advanced.
You need to do the same thing which happens with fab, first create a class extendingCoordinatorLayout.Behavior<View> and implement it like other fab examples. just remember that it won't work on simple listView and gridView.
Also here's a good detailed tutorial for you.
You Just have to set Scroll-Up & Scroll-Down listener of your Recycler view or Scroll View check Reference link.
Now base on Scroll-Up & Scroll-Down listener set VISIBLE / GONEof your footer view either it is LinearLayout or Toolbar with animation.
I have a ListView and each item contains a TextView displaying a number. I'd like to give my users the ability to change this number while staying on the ListView (as opposed to drilling down into a detailed view by clicking on the list item).
What I'm looking to do is to slide in a layout from the bottom of the screen that covers about half of the screen. I'd like this layout to be OVER the Activity behind it (as opposed to being part of that Activity's layout and simply showing it). I'd also like it to be model (or seem modal). Meaning the Activity behind it can not be focused and manipulated. In this layout I will essentially create a calculator.
What I need help with right now is:
1) How to display a layout over the current Activity
2) How make the background (the Activity) modal
Could someone point me to some tutorials/resources and/or give me a few tips?
use an Animation. here is a small tutorial on them: http://developerlife.com/tutorials/?p=343
initially, the view you want to be modal must be placed where you want it to show up(and visibility set to gone).
use a translate animation to visually move the view from below the screen to halfway up the screen. once the animation starts, set visibility to visible
try disabling all views that the user should not be able to interact with after you have started the animation holding the calculator view