public class CompanyListFragment  extends Fragment {

  private Activity activity;
    private ListView companyListView;

  @Override
  public View onCreateView(LayoutInflater infalter, ViewGroup container, Bundle savedInstanceState) {
    View view = infalter.inflate(R.layout.companylist_for_sport, container, false);
    companyListView = (ListView)view.findViewById(R.id.companyListView);
    return view;
  }

}

注意1:  是在 onCreateView 中

注意2:  是 view.findViewById 而不是 activity.findViewById

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-08
  • 2022-12-23
  • 2021-10-18
  • 2022-12-23
  • 2021-07-27
  • 2022-12-23
猜你喜欢
  • 2021-11-27
  • 2021-12-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-15
  • 2022-12-23
相关资源
相似解决方案