Handling orientation changes with Fragments

后端 未结 3 960
别那么骄傲
别那么骄傲 2020-12-19 18:11

I\'m currently testing my app with a multipane Fragment-ised view using the HC compatibility package, and having a lot of difficultly handling orientation chang

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-19 18:23

    It seems that the onCreateViewMethod was causing issues; it must return null if the container is null:

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {   
        if (container == null) // must put this in
            return null;
        return inflater.inflate(R.layout., container, false);
    }
    

提交回复
热议问题