그래서 뷰 페이저 내에서 고정 된 2 개의 탭을 사용하는 앱에서 작업하고 있습니다. 나는 RecyclerView
안에 ViewPager
을 가지고 있지만, RecyclerView
은 수평 스 와이프에 응답하지 않습니다. onInterceptTouchEvent
및 onTouchEvent
을 무시하여 ViewPager 내의 페이지를 변경하기 위해 스 와이프를 비활성화했습니다. 뷰 페이저의 setFocusable(false)
및 setFocusableInTouchMode(false)
을 아무런 소용이 없다고 불렀습니다. 어떤 아이디어?RecyclerView 내의 ViewPager가 작동하지 않습니다.
// ViewPager code
pager = (NoSwipePager) findViewById(R.id.pager);
pager.setFocusable(false);
pager.setFocusableInTouchMode(false);
adapter = new FormTabAdapter(getSupportFragmentManager(), form, editing);
pager.setAdapter(adapter);
pager.setCurrentItem(0);
tabs = (PagerTabStrip) findViewById(R.id.tab_strip);
tabs.setTabIndicatorColor(Color.WHITE);
tabs.setBackgroundColor(Color.parseColor("#A52A2A"));
tabs.setTextColor(Color.WHITE);
// RecyclerView code
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(act);
linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
rv.setLayoutManager(linearLayoutManager);
((SimpleItemAnimator) rv.getItemAnimator()).setSupportsChangeAnimations(false);
elementsAdapter = new ElementsAdapter(listener, act, new LinkedList<>(elements), editing);
rv.setAdapter(elementsAdapter);
ItemTouchHelper.Callback callback = new ElementTouchHelper(elementsAdapter);
ItemTouchHelper helper = new ItemTouchHelper(callback);
helper.attachToRecyclerView(rv);
xml 레이아웃을 공유 할 수 있습니까? –