Android creating a Spotify like slider menu - android

I am making an app that should implement a slider menu like the one in Spotify (where you slide the triangle in the middle to show the current playing song). The problem is I can't seem to figure out a decent method of doing this. I tried it with a Facebook like menu I found here.
However that just provides me with 2 linear layouts which are placed next to each other and are basically stretched or unstretched when expanding the menu. This gives some layout issues when expanding/collapsing (all items are placed below each other in the linearlayout when expanding and are quietly moved into the right place when collapsing the menu again).
In Spotify on the other hand it seems as if the layouts are on top of each other when the menu is expanded. This seems like a much cleaner way. However I have no idea on how to tackle this and Google doesn't really provide a lot of answers. Physically sliding the menu up isn't necessary, just getting the layouts on top of each other with some sliding animation on clicking the menu button.
Sorry for the long post, it seemed necessary to specify the question.

You dont need to re-invent a view or do anything fancy to get this functionality. Its called SlidingDrawer and is already available in the framework. Read this and this or watch this video.

Related

Activities overlapping

I am new to writing Android apps, I have been using the internet and Android Studio to create an app for my club as a bit of fun and learn along the way. I have been watching videos, using tutorials and walkthroughs and I am getting to learn the basics.
However, I have got stuck. I used a drawer template from Android Studio and added the activities I needed and buttons on the main screen to the activities and they all worked fine, no overlapping. When I tried to link the drawer icons to the activities, rather than use the buttons on the main screen, they work, but the app (visually) puts the next activities content on top of the one before.
I cant find anything on the internet except something called backstacking, but that is described when the back arrow is used, my problem is to do with selecting an activity from the drawer menu. I have attached a picture to show what I mean. It gets worse the more menu items that are selected.
If anyone could help, it would be great!
If you are using XML root layout as a constraint layout maybe your constraints are missing. If you are using constraint layout set both top/bottom and left/right constraint.
If your constraints only top for example it is look good on desing but in device that dont know where to positioning left or right and automatically positioning 0 point to top.
When you click one any one menu item put the visibility of other images as gone like
visibility(View.GONE);
and the one selected to be visible

Non-sliding content and action bar using SlidingMenu library

I am using Jeremy Feinstein's SlidingMenu library to implement a sliding menu on the right.
Is there any way to make the menu slide out without displacing/pushing the content view to the side? Currently, when the menu slides out, the content also gets pushed towards either the left or right (depending on which direction the menu is coming out from). I would like to make an implementation where the menu appears from either the left/right but "sits on top" of the content view (content view never moves, the menu view literally flies in and out).
Ive been digging about but there doesnt appear to be a simple function i can call to enable this. Do I have to implement it myself or am I missing something?
Time to answer my own question! :D
It seems that after looking through the source code of Jeremy Feinstein's SlidingMenu library, what happens is that the library actually "extracts" out our view and then somehow join it together with the sliding-out view. After that, the views are merely scrolled around (I could be mistaken, but i know the extraction of view does occur. As for the way the library accomplishes the scrolling and sliding, i didnt look into it too much.).
So, the answer to my own question is : No, it cannot be done by the library. No simple function available (due to the way the library achieves the sliding effect).
In the end, i opted to use a framelayout with overlapping views. One visible, the other invisible. Then i just change visibility and animate the views.

Making a slidable view from top to down, similar to the one in Android

The idea I'm having is having a view that can be pulled down on top of the current view, with similar animation features like the one you can pull down from the top all the time, on Android Devices.
Here's an illustration:
The idea is to grab it and being able to pull it down on top of the other view, and then being able to interact with that view. To slide it up again, you should grab the bottom of the view (the grey area in the illustration) again, and then pull it up.
I haven't even worked with animations before but I found a lot of topics on that, while searching for solutions to my problem, including this: Slide down view in android
but my impression is that, that is about making animations when the user isn't touching the phone.
What is the best way to do this?
Is there a better way to do something very similar?
EDIT:
Here's the topic that made me find the solution: How to make an Android SlidingDrawer slide out from the left?
And here's the solution I used:
SlidingDrawer Top-to-Bottom
You could use a SlidingDrawer, this is a built in component into Android, but as far as I know it slides only from bottom - up.
If you a comfortable to modify your app design, then this could be an option for you.
However, on internet are some libraries of custom SlidingDrawer that lets you put the marker on any side of your screen, so you can drag it top-down, left-right, right-left.. any way you want.
Useful links:
How to make an Android SlidingDrawer slide out from the left?
SlidingDrawer Top-to-Bottom

Creating a menu like the new YouTube application

Any ideas how we can make a menu like the one that Google has implemented in their YouTube app. I've read this, but that solution differs from the behaviour of the YouTube application. Does anyone know a real way to go about this?
I'm talking about this:
I believe that they use a HorizontalScroll in a RelativeLayout.
Image that the menu is always there to the left. You make that first.
Then you place a HorizontalScrollView on top of that and then put your main content in that.
Set your horizontal scrolling properties to only scroll a certain max. Then you wire up your menu button to slide your horizontalscrollview to the max you set and that should be it.
You can always check the source to the People Application in ICS. They do something very similar.

Scrollable menu bar with left/right arrows

I am looking to create a navigation or menu bar similar to the functionality of the one at the top of the Fox News app. I started to code this myself using a Gallery but I'm not sure how to hide the left and right arrows when they are not needed. I was also wandering if you would have to use images for the menu items or if you could just use TextView or buttons so I could change the text without having to modify an image. I have seen this type of navigation on several apps and I tried all types of searches trying to find code examples but I must not be using the correct name for this type of scrollable menu because I couldn't find anything. If anyone has an example or provide a link to an article I would greatly appreciate it.
Look into HorizontalScrollView. It is a Layout that will handle the smooth scrolling and is likely to be much less of a hassle to work with than Gallery for this operation (I just added one for a similar reason).
To handle the left/right, look into setOnTouchListener. I'm not sure if you can get the current scroll position without making a new child class of HorizontalScrollView to access protected methods. There may be other ways, however - I didn't need to add buttons so I didn't investigate.

Categories

Resources