使用我的inflater多视图,使应用程序缓慢:(

时间:2014-03-29 10:15:39

标签: android if-statement android-fragments layout-inflater

public static class PlanetFragment extends Fragment {
    public static final String ARG_MENU_NUMBER = "menu_number";

    public PlanetFragment() {
        // Empty constructor required for fragment subclasses
    }
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        int i = getArguments().getInt(ARG_MENU_NUMBER);


        if (i == 0){
             inflater.inflate(R.layout.foodmenu, container, true);

             return getView();
             //급식
            }

        else if (i == 1)
        {
             inflater.inflate(R.layout.timetable, container, true);
             return getView();
             //수련회

        }
        else if (i == 2)
        {
             inflater.inflate(R.layout.timetable, container, true);
             return getView();
             //시간표
        }
        else if (i == 3)
        {
             inflater.inflate(R.layout.timetable, container, true);
             return getView();
             //가정통신문
        }
        else if (i == 4)
        {
             inflater.inflate(R.layout.timetable, container, true);
             return getView();
             //연간학사일정
        }
        else if (i == 5)
        {
             inflater.inflate(R.layout.yearevent, container, true);
             return getView();
            // 학교홈페이지
        }
        else if (i == 6)
        {
             inflater.inflate(R.layout.timetable, container, true);
             return getView();
             // 주번활동
        }

这是我的程序,使用带有多个视图的inflater,它会让我的应用程序变慢,有什么建议吗?谢谢:))

0 个答案:

没有答案