简体   繁体   English

如何在可扩展listview的childview中实现view pager?

[英]How to implement view pager in childview of expandable listview?

I have a requirement to implement expandable list view with view pager.I am successfully loading the expandable list view. 我需要使用view pager实现可扩展列表视图。我已成功加载可扩展列表视图。 when i click on expandable list view group item, child view is not loading the view pager and it's not giving any error. 当我单击可扩展列表视图组项时,子视图未加载视图寻呼机,并且未给出任何错误。 How to implement view pager in child view of expandable list view? 如何在可扩展列表视图的子视图中实现视图分页器?

Please help me...Thanks in advance... 请帮助我...提前感谢...
below is the sample code.... 下面是示例代码。...

@Override
   public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
       object1 = list.get(groupPosition);
       LayoutInflater inflater = (LayoutInflater) this.context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
       convertView = initFragmentUI(inflater, convertView, object1);
       return convertView;
   }

   public View initFragmentUI(LayoutInflater inflater, View listView, Object object1){
        ViewPager pager;
        FragementSliderPageAdapter sliderPageAdapter = null;
       listView = inflater.inflate(R.layout.layout_1, null);
       pager = (ViewPager) listView.findViewById(R.id.view_pager);
       List<Fragment> fragments = new Vector<Fragment>();
       // For all the different levels we are creating the Views for all the rounds.
       // So that user can see the previous rounds data also..
       //for (int i = object1.getRounds(); i >= 1; i--) {
       for (int i = 1; i <= object1.getRounds(); i++) {
           Fragment fragment = new FixtureSliderLayoutFragment();
           Bundle args = new Bundle();
           args.putInt("index", i); // Our object is just an integer :stuck_out_tongue:
           args.putLong("_id", object1.getId());
           fragment.setArguments(args);
           fragments.add(fragment);
       }
       this.sliderPageAdapter = new FragementSliderPageAdapter(((Activity)activity).getSupportFragmentManager(), fragments);
       this.pager.setAdapter(this.sliderPageAdapter);
       return listView;
   }

Try this 尝试这个

  collapsePager.setOnTouchListener(new OnTouchListener() {

                @Override
                public boolean onTouch(View arg0, MotionEvent event) {
                    // TODO Auto-generated method stub
                    int action = event.getAction();
                    switch (action) {
                     case MotionEvent.ACTION_DOWN:
                            // Disallow ScrollView to intercept touch events.
                            parent.getParent().requestDisallowInterceptTouchEvent(false);
                         ActivityExpeditionsExpandableView.expandableList.setScrollContainer(false);
                            break;

                     case MotionEvent.ACTION_UP:
                            // Disallow ScrollView to intercept touch events.
                         parent.getParent().requestDisallowInterceptTouchEvent(true);
                         ActivityExpeditionsExpandableView.expandableList.setScrollContainer(true);
                            break;

                     case MotionEvent.ACTION_MOVE:
                         parent.getParent().requestDisallowInterceptTouchEvent(false);
                         ActivityExpeditionsExpandableView.expandableList.setScrollContainer(false);
                         break;

                    }
                    return false;
                }
            });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android-如何在Android的Expandable ListView的子视图下添加另一个视图? - Android - How to add Another view under a childview in Expandable ListView in Android? 如何在可扩展列表视图中为子视图设置分隔线高度 - How to set divider height for childview in expandable listview 如何使用齐射在Expandable ListView中映射childView - How to map childView in Expandable ListView using volley 是否有可能在android的可扩展listview的childview中实现listview? - is it possible to implement listview inside childview of expandable listview in android? 可扩展 ListView 的 ChildView 工作不正确 - ChildView of Expandable ListView is not correct working 如何在抽屉式布局中使用普通Listview实现可扩展列表视图? - How to implement Expandable List view with normal Listview in drawer layout? 在可折叠的工具栏中,带有可扩展列表视图的分页器无法正常工作 - View pager with expandable listview not working properly in collapsing toolbar Android如何实现可扩展的listview过滤搜索? - Android how to implement expandable listview filter search? 如何在展开式列表视图中实现单选按钮 - How to implement radio button in Expandable listview 如何确保在android的可扩展列表视图的子视图中仅选择单个单选按钮? - How to make sure that only single radiobutton is selected in childview of expandable list view in android?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM