@Override
        public int getCount() {
            if(mTestPaperList != null){
                return mTestPaperList.size();
            }
            return 0;
        }你listview的item返回时0,就是没有控件,你当然看不到了

解决方案 »

  1.   

    当mTestPaperList 是null,返回的肯定是0.当mTestPaperList有数据时返回的就不是0了。我看过,不显示的时候,数据是有的。
      

  2.   

    将initView();放onActivityCreated中试试。
      

  3.   

    没有效果,还是不显示,
    很奇怪,第一次是能显示listView的,切换一下之后就不显示了。
      

  4.   

    Fragment中如下这段代码有问题,    public View onCreateView(LayoutInflater inflater,
                @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
            mRootView = inflater.inflate(R.layout.test_paper_all_fragment,
                    container);
            initView();
            System.out.println("xbin:onCreateView");
            return super.onCreateView(inflater, container, savedInstanceState);
        }改成return view后listview就可以显示。    public View onCreateView(LayoutInflater inflater,
                @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
            mRootView = inflater.inflate(R.layout.test_paper_all_fragment,
                    container);
            System.out.println("xbin:onCreateView");
            return mRootView;
        }
    怀疑是RootView中有多个Id一样的view,系统选用了最初的那个,导致修改都在最初建的那个view上,后面的view内容不会改变。