I need to show a view sliding up for all my pages(fragments). Just like navigation drawer working. I don't want to include layout in every view and animate. Please suggest a solution
Create a common base class that your fragments extend from. What is the purpose of the sliding view? Does is just animate a scroll within a fixed space? Does it move above it up when it animates in? Does it overlay over the view as it slides up? Need more clarification.
You can use something like AndroidSlidingUpLibrary.
I'd avoid using it for scrolling views, it is nice though.
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've been using Phonograph music player for a while and it's a really good looking app in my opinion. It has a very nice sort of header: basically there's the toolbar wich slides up and down along with the recycler view hiding behind the status bar when scrolling down and coming back visible when scrolling up, the difference with other toolbars show/hide animations is that this one does not actually have two rigid states (hidden or shown) but instead it can be half covered, 70% covered, 80% covered and so on, it moves at the same speed of the recycler view, it's really different than the ActionBar.hide() .
Little clip to explain what I'm talking about:
http://i.imgur.com/JCIiFAA.jpg
I've searched the web for solutions but I haven't found nothing close enough but I think that the Observable Scroll View library might be a good starting point (Have already done some testings but so far it has those 2 rigid states wich I don't want).
I am using an activity MainActivity.java and setting its content view to activity_main.xml, how can I achieve that result?
Also how can I make that view pager selector just below the toolbar but sticky?
CoordinatorLayout from Design Support Library is what you are looking for.
See Tutorial here https://mzgreen.github.io/2015/06/23/How-to-hideshow-Toolbar-when-list-is-scrolling(part3)/
First of all you need to wrap up your Layout with Coordinator layout and set this flag on Toolbar
app:layout_scrollFlags="scroll|enterAlways"
I've looked around for a while and cant find the answer. How do you make a screen transition so that the background stays in place while the elements displayed move? Basically, Im trying to emulate the look for sliding through pages of apps on an iphone or android phone. Any way to do this? Do i have to use fragments? This question has kind of bad wording, ask me to clarify if you're confused on anything.
Use a frame layout with the background set as an image that you want. with a view pager as a child view. The view pager will use different fragments and the view pager should have each Fragment with a transparent background. Let me know if you need help with that any more, it should work no problem.
If the background is more complicated, use another layout to hold child views and still have the main layout be a frame layout. You want the frame layout because it can stack views on top of eachother. Put the view pager as the last view in this case, and ensure each Fragment is transparent.
What I am trying to do is to have a menu appear over listView. Just like in okCupid app :
when you click menu below the picture :
https://ssl.gstatic.com/android/market/com.okcupid.okcupid/ss-480-3-11
it extends itself over the background view :
https://g1.gstatic.com/android/market/com.okcupid.okcupid/ss-480-4-11
I have a feeling that this particular app is done in Sencha or JQuery mobile or similar technology but is it possible to get same effect in native app?
thanks
Most layout classes 'help you' by avoiding widgets to overlaps, but with the RelativeLayout you have more flexibility to create overlapping views.
To be sure the overlay view is on top, you can call ViewGroup.bringChildViewToFront() on the relative layout.
In your example the top view also has a partially transparent background.
Try using FrameLayout and add appropriate transperency for the view
I can look around for some example code later but the basic idea would be to have a MenuView class that draws your menu and animates in and out by setting the content of the menu visible or not.
Then just have all your content be on top of that MenuView by using the relativelayout align_parentBottom and set the content to above the menuview.
I'm trying to create a Popupindow in which the views can be changed by swiping. Each view should also be scrollable when larger than the popup window. I also want to move only one view when swiping. I can't find any simple way to do that (the Gallery move several views when swiping).
Is there any widget I missed or do I have to implement everything to achieve that (with ViewFlipper and gesture detection for instance)?
Anybody can help with the best way to do that?
Thanks
I've found and ended up using the fantastic HorizontalPager.