fragment不能用findviewbyid

--------自己做笔记----------摘自CSDN----
public class FragmentA extends Fragment {

private View view;

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

@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
TextView textView1 = (TextView) getView().findViewById(R.id.textView1);
textView1.setText("改变");
}

 

posted @ 2016-09-19 21:08  Nicolellu  阅读(1579)  评论(0编辑  收藏  举报