Add view to a recyclerview from adapter? - java

Is it possible to add a view to a recyclerview from the adapter, without having to use some layout?

Related

Use RecyclerView and ViewPager in CoordinatorLayout

I have a layout, I need to use recyclerView and TabLayout and ViewPager in the last item in CoordinatorLayout.
but just recyclerView scroll and show, TabLayout and ViewPager don't show.
anybody can help me?
<CoordinatorLayout>
<AppBarLayout>
<CollapsingToolbarLayout>
<Layout/>
<Toolbar/>
</CollapsingToolbarLayout>
<TabLayout/>
</AppBarLayout>
<ReyclerView/>
<TabLayout/>
<ViewPager/>
</CoordinatorLayout>
What's the size of the RecyclerView? Is it MATCH_PARENT? Try setting a smaller height to recyclerView and check whether the viewPager is visible. You need to enclose all three views inside scrollView and make recyclerView, a nested scroll.

How to implement View Pager inside Recycler View in android in the same class?

I have implemented View Pager separately and it's working fine. But how can i put that view pager inside Recycler View. But the problem is my class already extends Recycler view so to implemet View pager inside Recycler view i need to extend the class to FragmentActivity() to work with View Pager. But the class already extends Recycler view. So multiple inheritance is not allowed in Java. Is there any way to achieve this??

View Pager and Gridview wrap_content

I have custom view with extends LinearLayout. Custom view is viewpager with grid view inside. I add "wrap_content" wherever possible, but my view spend whole screen or only one grid's view line.
I find examples GridView with wrap_content function, but it is not help me

How to add two Fragments with RecyclerView in a single layout and Scroll them?

I have a layout with two fragments. Both fragments have a Recyclerview. I want, When I scroll any of a recyclerView Then another recyclerView also scrolled automatically. How can I do this?
If you don't see each fragment at the same time, you could get the position of the viewable RecyclerView when you change views, then set the other RecyclerView to the same position.

How to show a swipeable horizontal list view in android?

I have an xml file for a custom list item which contains two text fields and an image in a box. How can I show such listview which can be scrollable horizontally showing one list item after each horizontal swipe?
How to show a swipeable horizontal list view in android?
A RecyclerView with LinearLayoutManager with HORIZONTAL orientation.
LinearLayoutManager layoutManager
= new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false);
RecyclerView myList = (RecyclerView) findViewById(R.id.my_recycler_view);
myList.setLayoutManager(layoutManager);
Source: How to build a Horizontal ListView with RecyclerView?
Update:
showing one list item after each horizontal swipe?
For this you need a ViewPager.

Categories