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
Related
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
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 am looking to create an app where some categories that the user can choose from will be shown. The best UI I could find is shown in this image:
https://lh3.ggpht.com/swzmwICOMNjKmLH_HyAWh0VQ49BN7vU6PG3qEpsSnF1HWcG1CmpQi1BTBxdVczZx8pY
The screenshot is of the "Parenting Ages & Stages" android app. The best part of the above shown home page is that there is no scroll bar at the bottom and the user can use swipe gestures to see various categories.
Any idea how I can achieve the same effect?
It would be better to use ViewPager in your case
http://developer.android.com/reference/android/support/v4/view/ViewPager.html
It may Help you!
I'd like to make a view in my Android app that flips between multiple views on a swipe/fling. I'd like it to behave more or less like the Android Launcher behaves when flipping between views. In particular,
It should flip views on swipe.
Generally a swipe will flip between one view and the next. It should not fling across all of the views.
If you swipe slowly, you should see the views dragging as you're swiping, eg. the way the Launcher does it.
I tried using a ViewFlipper with a GestureOverlayView as per Romain Guy's blog post here, but there's no indicator to the user as they're swiping. This makes discoverability difficult, which is presumably why Launcher does it the way they do.
I tried using a Gallery object, but when I swipe from left to right, there's a certain amount of momentum that flings the users through all the views rather than just taking them to the next view.
Is there a good way to accomplish what I'm trying to do?
I know this is an old question but ViewPager is created for this exact same purpose. ViewPager is part of android compatibility package and more can be found at http://android-developers.blogspot.com/2011/08/horizontal-view-swiping-with-viewpager.html
Take a look at HorizontalPager. It's actually based on RealViewSwitcher, which in turn is based on the Android homescreen's code, and supports snap-to paging with drag feedback, as well as nested vertically-scrolling subviews. Gesture support for fast swipes isn't all it should be, but this may get you part of the way there (and I'd welcome contributions back).
EDIT: As of 2012 you're much better off using Google's ViewPager - it's in the compat library.
Check out SwipeView within this project https://github.com/fry15/uk.co.jasonfry.android.tools It does exactly what you want it to do and is super simple to implement.
#CommonsGuy extended ViewFlipper to do it.
https://github.com/commonsguy/cwac-viewswiper
Ihaven't used this one yet so im not sure if it moves with your finger like the launcher if not your going to have to make an OnTochListener to do it for you in me.ACTION_MOVE you will update the view to change its position. I'll post some sample code when I get home if you don't get another answer.
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