Android - How to implement Google Newsstand like layout? - android

I'm trying to clone the “view article" fragment layout of Google Newsstand app. It has an ImageView on the top that shrinks to become a Toolbar when we scroll downwards, just below the ImageView lies a TextView that contains the text content of the article. While creating the layout itself is pretty easy, implementing the special kind of scroll effect that shrinks the ImageView into a Toolbar is pretty tricky. Since, most of the updated Google Apps containing material design(e.g. - Play Store, Google+, etc.) contains similar kind of layouts, I was wondering if there's any widget/custom library available for the same. If so, what is it called and how to implement it?
Here's what the layout looks like:

You can use libraries like NotBoringActionBar or Header2ActionBar, but, as the babe says, they're Action Bars and in Lollipop they are deprecated.
Anyways, you can find them on GitHub.

This is called the 'Flexible Space with Image' pattern. It is a popular scrolling technique. The new Android Design Support Library enables you to implement this with ease. This post should help you make it.

Related

What Layout XML should I use for the about page of an android app?

I can't seem to find any good resource or guidelines for making the about section of an app I'm making.
Using a Preference xml seems not a good idea to me as there are no preferences to make. I need to just display textual information. The only interaction required is for showing those Open-source licenses, TOS, the version, etc.
See this about page of the Google app:
I have no clue what is a good (may not be the best) way to implement like in the above linked image.
Any help would be appreciated.
If you want to implement something like this your best bet would be using a RecyclerView with an DividerItemDecoration (for the grey line). The item of your RecyclerView simply needs to support a Title and a Subtitle. The Subtitles visibility should be gone by default, so your item (which should be wrap_content) is not unnecessarily stretched. This way you can reproduce the screen of the image you have linked
If your about page is a static one use constraint layout as parent and textviews as children. But if it is a dynamic list use recyclerview for better performance.

Android: material design's Floating Action Button (FAB) and shifting views

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.

The buttons on Google play cards (CardView & RecycleView)

I've just started working on CardView and RecycleView and I want to know what are the side buttons that looks like 3 dots on every card and how to implement it.
Cards like we see in Google Play Store app, where there are cards with buttons.
I don't have enough reputation to post a picture but I'm posting this link where you can see it and the buttons are marked in red circle.
I don't think adding a toolbar on every card is a good idea (as suggested in another answer). As you can see in the image itself, there is no space for a full-width toolbar due to images taking up width of layout. So the best way will be to implement it using an ImageButton. Just add an imageButton on top and configure it to open a drop down menu or dialog or whatever.
P.S. Yes, there can be multiple toolbars according to new material design guidelines but having one on every card is probably not a good idea. Especially when it can't even be a full-width component.
You are looking for Toolbar.
It's a new Android Pattern to generalize ActionBar to use in multiple enviroments, like Cards and others.
How to use it: http://android-developers.blogspot.com.es/2014/10/appcompat-v21-material-design-for-pre.html

Is there a library for Floating Action Buttons (FAB) with Labels?

Is there a library for creating Floating Action Buttons with labels (similar to the Evernote app)?
Evernote Screenshot
The popular libraries seem to be
https://github.com/futuresimple/android-floating-action-button (closest to what I want... ability to expand hide "sub" actions)
https://github.com/makovkastar/FloatingActionButton (Primary function is to hide/show with a scrollview, recyclerview, or listview)
https://github.com/oguzbilgener/CircularFloatingActionMenu (library which has been around pre-lollipop)
Neither of these, to my knowledge, have this capability. Before re-inventing the wheel, has somebody already done this?
This feature request ended up being implemented in https://github.com/futuresimple/android-floating-action-button. This includes labels on both the left and right sides.
If you're interested, see the discussion here: https://github.com/futuresimple/android-floating-action-button/issues/22#issuecomment-66155108
Disclaimer: I haven't used this (yet).
I'd recommend this library over others that I've seen.
Nowadays there are available techniques of manipulating behaviour of the view that enable you to program FloatinActionButton as you want and to have joy that you have made it by yourself!
Fade in/out FloatingActionButton while scrolling RecyclerView . DETAILS
Slide down/up , beside it blog says how to:
Expand floatingActionButton and show subFloatingButtons. DETAILS HERE
There is to much details, "how to do". Therefore I've attached just links to blogs. Anyway I encourage you guys to take a look at those blogs. You will have total control over your application. Currenty I use all solutions from both blog's. Enjoy!
Especially the last library you mentioned looks quite sophisticated. To my knowledge, you can set any kind of View you want to be shown as a Button.
This View could simply be a custom-view of yours that shows an image as well as a label.
In case anyone is still looking for this functionality: I made an Android library that has this ability and much more, called ExpandableFab (https://github.com/nambicompany/expandable-fab).
The Material Design spec refers to this functionality as 'Speed Dial' and ExpandableFab implements it along with many additional features.
Nearly everything is customizable (colors, text, size, placement, margins, animations and more) and optional (don't need an Overlay, or FabOptions, or Labels, or icons, etc). Every property can be accessed or set through XML layouts or programmatically - whatever you prefer.
Written 100% in Kotlin but comes with full JavaDoc and KDoc (published API is well documented). Also comes with an example app so you can see different use cases with 0 coding.
Github: https://github.com/nambicompany/expandable-fab
Library website (w/ links to full documentation): https://nambicompany.github.io/expandable-fab/

sliding layout like google maps v7

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!

Categories

Resources