I would to copy the iOS Pickeron Android with the animation while scrolling.
There is an example:
.
I found some answershere and here that's not what I want.
Any help would be appreciated.
You can use CarouselLayoutManager to achieve this look, with this library you will have one elevated item that will be above all others and this will give your list the desired look.
How to use:
In your gradle:
implementation 'com.azoft.carousellayoutmanager:carousel:version'
When declaring an adapter:
final CarouselLayoutManager layoutManager = new CarouselLayoutManager(CarouselLayoutManager.VERTICAL);
final RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
recyclerView.setLayoutManager(layoutManager);
recyclerView.setHasFixedSize(true);
You can also use Android-PickerView library or WheelPicker, I have only worked with the first suggested library above so I don't know how those 2 will work for you.
Related
So I've spent the last few hours trying to create a horizontal scrolling Recyclerview.
I'm pretty sure that I'm following the correct techniques for setting the LayoutManager for the Recyclerview, but it just won't work. on the preview it works, but once I push it to the Emulator, it still renders the list in vertical mode instead of horizontal.
I haven't made any references/changes to the Recyclerview programmatically (I tried setting the LayoutManager before, but it also didn't work).
Screenshot showing the issue:
try adding this code to your java class in the onCreate Method
mRecyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));//set your recyclerview layout to hoizontal
also try posting your java or kotlin code next time to get better feedback.
You should call Layoutmanager from fragment/activity. If you are using Kotlin, do this
XML
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/recycler"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
Fragment/Activity
val layout = LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false)
recycler.layoutManager = layout
*Change this with requireContext() if in fragment
hi i want to make a recycler view to take items horizontal as many as the screen fit but with vertical scroll like this image as example
I try with StaggeredGridLayoutManager but it must specify the number of column want the column take as screen size any help will be good
You can use FlexLayoutManager for this kind of design FlexLayout
Here is a example snippet to use FlexLayoutManager in RecycleView
RecyclerView recyclerView = (RecyclerView) context.findViewById(R.id.recyclerview);
FlexboxLayoutManager layoutManager = new FlexboxLayoutManager(context);
layoutManager.setFlexDirection(FlexDirection.COLUMN);
layoutManager.setJustifyContent(JustifyContent.FLEX_END);
recyclerView.setLayoutManager(layoutManager);
Their are many attributes to use FlexLayout Go through the documents on github
As Burhanuddin Rashid commented, you should use the FlexBoxLayout. It has a LayoutManager for RecyclerViews, so the additional code will be minimal.
https://github.com/google/flexbox-layout#flexboxlayoutmanager-within-recyclerview
How to Achieve this layout shown in below image Please suggest me how to make layout at run time while my contain is loading directly from web service.
You can use FlexboxLayoutManager for this, here is the snippet
FlexboxLayoutManager layoutManager = new FlexboxLayoutManager();
layoutManager.setFlexWrap(FlexWrap.WRAP);
layoutManager.setFlexDirection(FlexDirection.ROW);
recyclerView.setLayoutManager(layoutManager);
And in Gradle file you will have to compile this dependency
compile 'com.google.android:flexbox:0.3.0-alpha3'
for more you can check this link here
How to make a GridView look something like that?
I found similar library but it is implemented using ListView and I want using RecyclerView.
Thanks.
To do this use RecylerView and StaggeredGridLayoutManager
recyclerView = findViewById(R.id.recycler_view);
mAdapter = new YourAdapter(yourParameters);
recyclerView.setLayoutManager(
new StaggeredGridLayoutManager(spanCount /*in your case number of columns*/, StaggeredGridLayoutManager.VERTICAL /*orientation*/));
recyclerView.setAdapter(mAdapter);
Such as ListView, it invokes smoothScrollToPosition(index)
Android Developer Doc doesn't have HorizontalListView. I downloaded this custom HorizontalListView from GitHub, but I'm confused about how to use HorizontalListView on scrolling automatically.
could recyclerview scroll loop, and it scroll in specified time
I recommend using recyclerview with a linear layout manager that is set in horizontal mode
If you need only a HorizontalListView RecycleView is the way to go.
Just add this line of code to convert it to a HorizontalListView
LinearLayoutManager layoutManager= new LinearLayoutManager(this,LinearLayoutManager.HORIZONTAL, false);
mRecyclerView = (RecyclerView) findViewById(R.id.recycler_view);
mRecyclerView.setLayoutManager(layoutManager);
Refrence can be found here https://developer.android.com/reference/android/support/v7/widget/RecyclerView.html
you can use recycle view and set layout manager as follows
listView= (RecyclerView)findViewById(R.id.hlistview);
LinearLayoutManager layoutManager=new LinearLayoutManager(this,LinearLayoutManager.HORIZONTAL,false);
listView.setLayoutManager(layoutManager);
See this example on github