ViewPager textview not images - java

Could anyone please help me as I want to implement viewpager textview, instead of images, I have searched on google however I cant manage to find any tutorials or help.
I have looked android developer sample. http://developer.android.com/training/animation/screen-slide.html#views
This is something which I am looking for however I want to show two different views of textviews, instead of repeating the same textview when swiping the screen. The sample shows 5 views which are all repating the same textview, however I want to have two views which are two different textviews, e.g, textview1 and textview2.
Could you please advise however I am able to do this, or if their are any tutorials to help me to achieve this.

You can use two different fragments and put different textview in each. I am providing the link of viewpager with different fragment.
How to implement a ViewPager with different Fragments / Layouts

Related

how to show mutiple image in grid like facebook and linked in

I need to show multiple image in grid like example given here.
and also need plus icon while images is more than some certain counts
There are multiple ways to implement it
Two horizontal/vertical LinearLayout
TableLayout with two rows
ConstraintLayout which its children are chained together
GridView
RecyclerView with GridLayoutManager
and more ... :D
Possibly you want to fetch the images dynamically, and there are several collection views: RecyclerView, ListView etc. RecyclerView is common since you can modify the layout(for your case, columns) with various LayoutManagers. Since you haven't provide any code, I cannot help you with that, but here is a guide that might be helpful.
For the plus icon mechanism, you can modify your RecyclerViewAdapter code, limiting the count(in getItemCount()) to a certain number and visible a transculent foreground with '+number' in the ViewHolder code for the last item.

Parse different data through the activity in the same activity

I am building an E-Commerce App and I have an activity showing image slider, description and related items, and in image slider I have put an arrow to change the product on the arrow click I want to be in the same activity but data should be different.How should I do that need your help guys.
You should try doing it by urself in one of the many ways its possible to. Then we could provide some help with your idea or show you better solution. I think you are looking for RecyclerView (https://developer.android.com/guide/topics/ui/layout/recyclerview). It lets you show some similar views but with different data inside. Also as an item inside RecyclerView you can try CardView.
Using only RecyclerView you can also use:
https://stackoverflow.com/a/46084182/8713068
You can also search for a library that has everything you want inside already implemented. For example the first library that came out after i typed it in google : https://github.com/Ramotion/cardslider-android.

How to PERMANENTLY remove layout items in android java

Fairly inexperienced in java still, so I was wondering (as I haven't really found anything useful online) whether there was a way to permanently delete a textview (or any other layout entry, ratingbar etc.) from an android layout in the onclick function.
I want a user to be able to submit a rating only once in every rateable activity, you see.
I have tried everything I can get.
ratingbar.setVisibility(View.GONE);
Works while you're in the activity, yet when you restart again the ratingbar is back. I've also tried:
linearlayout1.removeView( ratingbar );
However, this does the same as
ratingbar.setVisibility(View.GONE);
On reload the ratingbar is back. If anyone can help, that'd be greatly appreciated.
Thanks in advance.
Well you rather choose not to create a view,
than deleting a view that's created.
i guess you could create TextView programmatically
and decide if you want to attach it to your layout or not in java code.
See : Android: Add a textview to linear layout programmatically

ViewPager or Fragments?

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.

checkable spinner for android app

I am working on a mapView app and I would like to have a button much like the layer button in google maps that allows someone to show or hide an option from a spinner. I have searched to try and find how to accomplish this but have been unsuccessful. Can someone point me in the right direction of what to search for or what to implement?
you can just make a custom view that has bunch of checkboxes and textviews (stacked horizontally as a bunch of relativelayouts stacked in a linearlayout). this is probably easy enough to do if you don't have a ton of items. (I'm assuming you don't because you referred to the maps options)

Categories

Resources