我需要使用view pager实现可扩展列表视图。我成功加载了可扩展列表视图。当我单击可扩展列表视图组项时,子视图不加载视图寻呼机,它没有给出任何错误。 如何在可扩展列表视图的子视图中实现视图寻呼机?
请帮助我......提前致谢...
下面是示例代码....
@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;
}
答案 0 :(得分:0)
试试这个
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;
}
});