Android + ListFragment with a custom view hierarchy

后端 未结 5 1004
名媛妹妹
名媛妹妹 2021-02-12 22:28

I\'m attempting to customize the fragment layout by returning my own view hierarchy from onCreateView(LayoutInflater, ViewGroup, Bundle). This inflates my custom v

5条回答
  •  轮回少年
    2021-02-12 22:49

    use this pattern, works perfectly!

    inflater.inflate(R.layout.list_layout, container, false);
    

    public View inflate (XmlPullParser parser, ViewGroup root, boolean attachToRoot)

    attachToRoot Whether the inflated hierarchy should be attached to the root parameter? If false, root is only used to create the correct subclass of LayoutParams for the root view in the XML.

提交回复
热议问题