2

I am using custom PagerAdapter in my application, in that override the method setPrimaryItem. When I view the html using webview through PagerAdapter, the setPrimaryItem method is keep on calling continuously. Because of that html is flickering in the screen. Anybody knows why it's behaving like this?

The setPrimaryMethod() code below:

@Override
    public void setPrimaryItem(ViewGroup container, int position, Object object) 
    {
        super.setPrimaryItem(container, position, object);

        ScrollView scrollView = (ScrollView) object;
        ViewGroup llViewGrp = (LinearLayout)scrollView.getChildAt(0);
        View view = llViewGrp.getChildAt(0);

        if (view instanceof StudentElementHtmlView) {
            List<StudentElementEntity> studentElementsEntity = entity.get(position).getElements();

            //iterate through all elements and set the element to save the answer
            for (StudentElementEntity element : studentElementsEntity) {
                //check for the html element entity
                if (element instanceof StudentElementHtmlEntity) {
                    ((StudentElementHtmlView) view).setElement((StudentElementHtmlEntity) element);
                }
            }
        }
    }

Thanks Krish

krish
  • 213
  • 1
  • 10

1 Answers1

0

I thought the reason may be that the gesture detector had been collision between ViewPager and WebView. You should override the onInterceptTouch() and onTouch() methods in child view,and invoke the requestDisallowInterceptTouchEvent(boolean flag) method in the child or the parent depend on your need。

Qun Qin
  • 2,622
  • 3
  • 14
  • 8