For better Understanding check this sample design
What I want to achieve is a sign up mechanism. Where when a user done filling page 1 and click next then
The next button stays at the fixed location
The indicator do an animation and change
The two field ("Full Name" and "Select your gender") get swapped out by the fields of Page 2.
Those fields in both pages will be in same Fragment, viewModel and repository. This is a simplified version of what I want to achieve.
I am a beginner in Android & already watched tutorials of viewPager2 but I'm pretty sure it won't help here. One thing I can do is, to use "visibility hide & show" but I don't think it would be the best practice. Hiding and showing will also not help in manually swapping the pages.
So, how to implement multiple pages/section in a single fragment?
Related
I often put user registration on one xml file with scroll view.
I have learned when a user sees too many fields they opt out of the app so I am planning to upgrade the layout to look like the one for gmail when you sign up on android app. It appears to be using tabbed view but not tabs available and user navigates to the next view by clicking next (refer to attached images).
First page
second page
MY QUESTION
My question is how do I create this views, do I need many xml layout files or put all stuff on one file and use visibility as in once it is filled and user presses next hide the inputs and reveal the next inputs. Note: Gmail appears to be scrolling to another page the way it would appear when using tabs.
You can use one activity to host multiple fragments. The new Android Studio update has Navigation Editor which you can use to achieve similar results.
it is totally up to you how you want to design this but the best thing is you use Fragment and viewpager instead of using two separate layouts.
See Here how to use fragment with viewpager
There are many ways to do this, If you have less content then play with visibility otherwise ViewFipper ( https://abhiandroid.com/ui/viewflipper ) Or can use Fragments
I need to create multiple "forms" (e.g. login, signup) and you should be able to fill in one information at a time.
After the user entered his first name he should swipe (like in ViewPager) and the next input should appear dependent on the previous (if he wants the newsletter, the next step should be entering the mail).
Some of the inputs are very complex like ordering items in a list and I thought it would be a good idea to use Fragments and the ViewPager but it is not.
The ViewPager doesn't handle the dependency on the previous input very well and it is not really possible to add custom animations.
I didn't find a library that fits my needs... Do you have an idea what I can do?
Will this library fit your needs:
https://github.com/romannurik/Android-WizardPager
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 am using a Viewpager for using user profiles. I have few requirements for Viewpager.
I want it to be locked in one direction. i.e. I want user should be able to swipe left only to load new fragments. Once he has moved to next fragment, he shouldn't be able to go back to previous fragment. I saw so many answers but could not infer a apt answer.
How to disable ViewPager from swiping in one direction User says he was unable to get the required result.
I want to use some good animation for fragment page change transition effect rather than simple sliding. I saw JazzyViewPager - https://github.com/jfeinstein10/JazzyViewPager but was unable to understand how to incorporate in my existing project.
In case, it is possible I was thinking of using a pan for some 3D horizontal rolling (Not a priority though).
First Problem's solution See Here and
Another Link
Second you can add Transition effect to fragment what you expect
step by step explanation give here
and also see This
I have existed code for two activities(ActivityA and ActivityB).
Now I need to have a another activity, which will act as my first and only screen of my application. This activity will be having two tabs on its header part and I need to display each of my Activity when user press on each tab.
I have done some search on this and found TabAcivity will be suitable choice, but it is deprecated now.
I saw many posts which are suggesting Fragments. But I dont want to change my existing code. Can any one suggest me easy method to incorporate this.
you can use Android Tab Layout with Swipeable Views
here i give Link in this link step by step information given. so i think you can get batter idea from that.
Tab Layout with Swipeable Views
you can also download code from this site and also see video in given sit