I need to make an application that will basically be a 5 "page" quiz with true and false buttons. I don't think that a new layout/activity is needed for each "page". That would be overkill. Would a fragment or ViewPager be appropriate? Does it break any Android Guidelines? They both seem to make sense to me. Maybe fragments a little more because of a tablet/alternate layout. Any ideas would be appreciated.
I've been using the ViewPager in one of my projects, for side swiping between similar yet distinctly different views.
It is working very well.
It depends on your flow. View Pager will work well if your users can randomly go through the views. If you want things to be in a specific order then ViewPager probably won't work.
you can achieved by creating 5 pages dynamically and load that in single layout/activity
By using dynamically load pages helps In future you want to add 2 pages of question its easy to do
According to your flow u can use the this also In same activity you can change the question just on click of button.
And if you want user to revisit all question u can use view pager.
Related
I would like to implement the following behavior in an android application:
So should I use fragments with horizontal ScrollView, a ViewPager or what exactly? Would it be better to use CardView?
And how to add the 2 dots at the bottom to show that we still have for example another page to show?
Finally, I need only one fragment/CardView to be present at a time. That is, I don't want to see half of the first fragment and half the second. That would be annoying.
I would like to know in general what pieces to use for this purpose.
Any help is much appreciated!!
I would use ViewPager. It will give you all of the functionality you're looking for and will allow you to add or remove pages easily in the future.
You will have to manually create a page indicator (the dots at the bottom) or use a library like this:
https://github.com/romandanylyk/PageIndicatorView
I am making an app and want to make sure I am following good practices before I proceed further and potentially turn my app into a "big ball of mud" implementation.
So right now the general idea I have in my head is where you have a row of icons along the top representing the different pages you can click on. You click the button/icon and it takes you to that page.
So this icon-row along the top would be constant throughout most of the app. The only thing that would change would be the contents below that icon-row.
Is it considered acceptable practice to use fragments here? Use one main activity that has the icon-row at the top and then have the container below that "swap out" fragments based on the icon clicked? And then each page is really just a big fragment?
Does this make sense, am I following good practice? Is there a better way to do this?
I am making an app and want to make sure I am following good practices before I proceed further and potentially turn my app into a "big ball of mud" implementation.
If that happens, try a good brand of laundry detergent, at least if you are using Twitter Fabric.
So right now the general idea I have in my head is where you have a row of icons along the top representing the different pages you can click on. You click the button/icon and it takes you to that page.
A typical implementation of that in mobile apps is to use tabs that contain your icons.
Is it considered acceptable practice to use fragments here? Use one main activity that has the icon-row at the top and then have the container below that "swap out" fragments based on the icon clicked? And then each page is really just a big fragment?
Most modern tab implementations are based around using a ViewPager as the container for the tabs, so the user can swipe the content or tap on the tab to switch to different pages. ViewPager can work with plain views for its pages, but the stock PagerAdapter implementations use fragments.
Even if you elected to eschew tabs, using fragments for the pages (whether wrapped in a ViewPager or not) is reasonable.
The big thing to watch out for is memory consumption. Android devices do not have infinite RAM.[citation needed] You need to make sure that you have a modest number of fragments outstanding at any given point.
Yes, this is the proper way to use the parent activity or fragment with this "icon-row". You can use the Toolbar+menu for example, if you want to preserve the Android look, use tabs+ViewPager or use custom view.
Then, in this activity/fragment you will have a layout that will work as a fragment container. In this layout you can replace the fragments dynamically using the FragmentManager of parent activity/fragment. Each of these pages is a separate fragment.
So yes, this is good/common practice.
You may read the how-to about replacing fragments here
I'm having a design issue. I'm not sure if this is a good way to do it but here is what I want to do.
I want a way for the user to quickly swipe or click on a button to change the data that is shown in a fragment which contains a list. I thought of using tabs but it seems that's more suited if you have different fragments for each tab and using only one fragment might not be best practices.
The reason I only want to use one fragment is because that code will not change for different tabs only the data that is given to the recyclerview.
Should I go forward with this or is there a better method?
I need some help.
I'm wanting to make an activity similar to this, but I'm not sure where to start.
Basically, it's like a texting UI, with the users question on the right and the answer on the left. I was going to use a list view for the sake of simplicity, but I dont' think it'd support this kind of structure.
I googled some layouts where I can scroll, but most of them require me to premake them, which isnt an option because its a dynamic chat log.
Does anyone here have experience with this kind of UI? Can you point me in any direction? I hate to ask such a strange question, but I don't even know how I'd word this situation on Google.
Thanks in advance.
What you're looking for is a ListView where you can return a different layout depending on whether the message is sent or received. A ListView is the most efficient implementation for this because its ideal for displaying a potentially large data set without having to keep a view in memory for every row.
This is achieved by extending the BaseAdapter in your application and overriding the getItemViewType(), getViewTypeCount(), and getView() methods (along with all the other methods required by a ListView adapter).
This is a good tutorial that serves as a walkthrough for this pattern.
Instead of using ListView, You may programmatically construct a viertical LinearLayout, and add TextView in each line, you can set the alignment of the TextView in lines accordingly.
In my Android APP I have this ListView where I wish that each item is divided in two parts and it could be swiped. I wonder what should be the best way of doing that since the SlidingDrawer is now deprecated (and is not swippable). I need it to be an easy way to implement and few stress to mobile processor.
The content would be different in each item so I need to be able to access the TextViews inside them.
This is the example I wish to the item od the ListView:
The user could Swipe between both fragments and check its contents.
Any idea, advice or tutorial on this matter? Thank you very much for your attention
Use a ViewPager. Really easy to use, just extend a FragmentPagerAdapter to create the fragments to swipe between.