我创建了 ViewPagerAdapter 并在 veiewpageradapter 中调用 Fragment2,但我需要在 fragment2 中创建列表搜索视图。
public class ViewPagerAdapter extends FragmentPagerAdapter {
@Override
public Fragment getItem(int arg0) {
switch (arg0) {
// Open Fragment1.java
case 0:
Fragment1 fragment1 = new Fragment();
return fragment1;
// Open Fragment2.java
case 1:
Fragment2 fragment = new Fragment2();
return fragment;
return null;
}
}
我的片段类
public class Fragment2 extends SherlockFragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Get the view from fragmenttab2.xml
View view = inflater.inflate(R.layout.fragment2, container, false);
//NEED TO CALL LIST SEARCH VIEW
return view;
}
}
是否可以在 onCreateView() 中调用列表搜索视图?