getLayoutInflater() in fragment

后端 未结 5 769
我寻月下人不归
我寻月下人不归 2020-12-04 17:27

I\'m trying to show my results search in a ListView on the Fragment, but it fails on:

LayoutInflater inflater = getLayoutInflater()         


        
5条回答
  •  广开言路
    2020-12-04 18:15

    In Activity you can use like this:

    this.getLayoutInflater();
    

    For Fragment you need to replace keyword "this" with "getActivity()"

    getActivity().getLayoutInflater();
    

    Hope this will help!

提交回复
热议问题