利用ViewPager+Fragment+slidingmenu側(cè)滑組件實(shí)現(xiàn)的小demo
19
20
public class ActivityFragment extends Fragment{
private View view;//緩存頁(yè)面
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
if(view==null){
view=inflater.inflate(R.layout.activity_fragment,container, false);
}
ViewGroup parent = (ViewGroup) view.getParent();
if(parent!=null){
parent.removeView(view);//先移除
}
return view;
}
}
評(píng)論