3

I want make a view as this picture: A viewpager have one page is a fragment, inside this fragment have a normal listview, and sometime have a special row that is a horizontal listview (not recycler view).

enter image description here

How do I make as abover and prevent conflict when scroll hozirontal listview with viewpager ?

mdtuyen
  • 4,470
  • 5
  • 28
  • 50

1 Answers1

0

there are two methods :

public int getItemViewType(int position)

public int getViewTypeCount()

if the type of item is horizontal listview that you can return this special item view in getView(),like this Android ListView with different layouts for each row

Community
  • 1
  • 1
jeetoul
  • 31
  • 6
  • This only method to make many type in listview, problem is how to scroll horizontal listview that is not conflict with viewpager – mdtuyen Dec 31 '15 at 08:51
  • Override viewPager's and horizontal listView's onInterceptTouchEvent(MotionEvent ev) method – jeetoul Dec 31 '15 at 09:30
  • Could you give me a code to implement it ? because I try some solution with that and unsuccessful – mdtuyen Dec 31 '15 at 09:32
  • horizontal listView's onInterceptTouchEvent() or dispatchTouchEvent() add 'getParent().requestDisallowInterceptTouchEvent(true);' if you want more logic,you need more code – jeetoul Jan 04 '16 at 06:19