ListFragment does not accept my layout

前端 未结 10 1384
情歌与酒
情歌与酒 2020-12-01 02:09

According to this link: ListFragment android developers

I want to set my custom layout for list, but it makes exceptions.

Here is the code:

p         


        
10条回答
  •  被撕碎了的回忆
    2020-12-01 02:52

    A little bit late, but did not see this answer.

    Inside Fragment:

        @Override
        public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
                final Bundle savedInstanceState) {
            final View view = inflater.inflate(R.layout.fragment_list_activity,
                    container, false);  
    
            ListFragmentHelper.adaptView(view);
    
            return view;
        }
    

    but bear in mind that in fragment_list_activity.xml you need to set the IDs android:id="@id/loading", android:id="@id/content" and android:id="@id/empty" for your views!

提交回复
热议问题