I'm trying to implement a navigation like in Play Store app or in the VLC app.
In the Play Store app, they use a navigation drawer where you can choose 'apps'. Then it is possible to swipe through 'views' (categories, home, top paid, ...) ( here is a picture to show what I'm talking about)
In the VLC app, they use a navigation drawer (?) in combination with a swipe view (?) for the audio section.
I was searching for a tutorial, but I couldn't find any suitable yet. Most of these tutorials use Fragment's - as far as I know, these aren't able to contain swipe views?
Could someone please give me a hint (in addition it would be nice to see some code) on how to get on with this? Thanks :)
Look into latest design support library, specifically for TabLayout, where you can specify fixed tabs (up to three usually), or swiping ones (many more).
http://android-developers.blogspot.co.uk/2015/05/android-design-support-library.html
There's also an awesome demo of it in an open source app called Cheesesquare.
https://github.com/chrisbanes/cheesesquare
A FrameLayout hosting a ViewPager could be used to achieve this. Just use a LinearLayout at the top of the layout to display your navigation buttons.
The ViewPager will allow the user to swipe through each fragment it contains, you can also set each button's onClick to have the ViewPager automatically swipe to the relevant fragment.
If you want to use TabLayout, look into Google I/O app on github. More specifically, take a look at SlidingTabLayout and SlidingTabStrip under iosched/android/src/main/java/com/google/samples/apps/iosched/ui/widget. Also take at look at this SO thread
Related
In android, i want to move from current to previous activity by left to right swipe as in iOS. I want to be able to even hold while swiping such as both activities are visible at the same time.
I want to introduce transition/animation effect just like in Telegram app. So please help how can i do it.
Tutorials or example code will work for me.
Thanks in advance!
You better use the Swipe animation with multiple Fragments inside one Activity: Creating Swipe Views with Tabs
take a look at this tutorial : HOW TO IMPLEMENT HORIZONTAL VIEW SWIPING WITH TABS
If you're already using Google's NavComponent library, you should try a library that I wrote:
https://github.com/massivemadness/Fragula
It's fully integrated with NavComponent, which means the navigation API stays the same, you only need to make some changes in NavGraph and NavHost container.
Here's the result:
I have a design for an app that will have a row of buttons below the action bar. Each button will open a different fragment. I am aware of ViewPagers, but I do not want the swipe between fragments functionality. I know that I can disable this functionality, but at that point is it worth using a ViewPager? I know this is a pretty common design paradigm, so how do most apps handle this sort of thing?
It seems like the ViewPager will provide some nice functionality out of the box, like switching between fragments and what not. So, I am leaning towards using one, but was hoping someone could provide some feedback on this approach.
Thanks!
Keep the buttons in the layout of your main activity. Have them call a function lets say loadFragment(Button button) on click.
This function then handles switching of the fragments, and you can change the display of the navigation buttons inside this function itself to highlight the appropriate button or something equivalent.
Google Design is always worth the reading.
Check http://developer.android.com/design/patterns/swipe-views.html for details.
Personally I have used ViewPager with tab layout for swiping purpose and it makes it easy to me to synchronise the transitions ( tabs and pages) where I put a red circle to the tab corresponding to the viewed page. With this approach I got a clean separated code.
I want to have a login view similar to foursquare, can any one tell me how can i achieve this ? i have this youtube video for reference. http://youtu.be/RmQH0s2f2D8
You can use ViewPager to achieve that.
Here are a few tutorials on it if the one above doesn't suffice.
Android User Interface Design: Horizontal View Paging
Android (support v4) ViewPager tutorial (including source code)
Working with Fragments and ViewPager on Android
You're looking for a ViewPager
The Docs are pretty good in this case, so that should help.
As far as the popup at the bottom of the screen, you can hook it in to a page change listener and animate it up/down depending on the page.
I'm trying to implement the title indicator like the one found in Google+ Android App; I've come across two implementation, one by Jake Wharton and the other by Mark Gjoel.
What I want is to be able to swipe on the indicator to switch between the different views, and swipe on viewpager to go back/forth on image results that I load from the SD card.
I've implemented the layout for the indicator, but I don't know how to "move it" (follow the users finger within the indicator layout) as the user swipes on it. Also, I don't know, how to move the viewpager at the same time with the indicator, so the interaction looks natural.
If you have Google+ App, try to do a swipe on the indicator in the stream section, and you will know what I am talking about.
Any tips would be greatly appreciated.
Following links may help you.
GreenDroid
AndroViews code
AndroViews video
ADW launcher
PageScroller
Look at the listeners in ViewPager, copy the same action to your listeners only the movement part, not everything what it does. Now, when you detect user swiping on your indicator, implement or call the function that does the swipe on the ViewPager , so that they move together.
HTH.
Try the implementation by chainsdd for Superuser app:
https://github.com/ChainsDD/Superuser/blob/master-dev/src/com/noshufou/android/su/widget/PagerHeader.java
My goal is to create a screen similar in function to the Stream page in the Google+ app (picture below for those unfamiliar). For the paging, I am using a custom ViewGroup so that it has smooth transitions that "follow your finger" rather than just snapping to the destination after the fling gesture has been made.
Question
Currently, I am going the route of using some TranslateAnimations to move the headings ("Nearby," "All circles," and "Incoming" in the screenshot) once a new page has been selected. This creates a couple of problems: the center heading doesn't follow the user's finger (as you can see the "All circles" heading does in the screenshot), and if the user begins on a page other than the middle one, I have not found an easy way to offset all of the animations temporarily without running them first since the animations do not move the actual views.
Am I going about this the correct way, or is there a much simpler way of accomplishing this that I am overlooking?
Thanks
After hours of searching and a little luck with search terms, I came across A Google+ like ViewPager page indicator.
I also came across Android ViewPager Indicator, created by the same developer who wrote ActionBarSherlock. Has a ton of examples, and is pretty easy to integrate with the FragmentPagerAdapter.
Google has published his own solution in support library.
Check:
PagerTitleStrip,
PagerTabStrip
Have just used ViewPagerIndicator solution and its very nice and smooth. You can demo the effect by looking at the demo from the Android Market here
I am not 100% sure, but I think it uses the new ViewPager.
Maybe you should look at the API 4+ Support Demos:
FragmentStatePagerSupport.java
FragmentPagerSupport.java