简体   繁体   中英

Horizontal Recycler View inside Tab Layout

The Problem

I have a Tab Layout and inside the Tab Layout I have a horizontal Recycler View. Sometimes when i try to swipe the recycler view, it just changes the tab position instead.

The Question

Is it possible that all touch events that are in the area of the recycler view, are not reported to the tab layout, so that all touch events in the area of the recycler view can only change the recycler view position and never the tab position ?

Create Tablayout using Viewpager and in fragment take recyclerview and set below code to make recyclerview scroll horizontally. hope it will help you.

      LinearLayoutManager llm = new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false);
    recyclerView.setLayoutManager(llm);
    recyclerView.setHasFixedSize(true);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM